zoukankan      html  css  js  c++  java
  • 1569=选夫婿1

     1 #include <stdio.h>
     2 #include <stdlib.h>
     3 #include <string.h>
     4 struct node
     5 {
     6     int a,b;
     7     char s[20];//结构体。
     8 } st[1001],t;
     9 int main()
    10 {
    11     int i,n,a,b,c,d,j,cnt=0;
    12     scanf("%d",&n);
    13     for(i=0; i<n; i++)
    14     {
    15         scanf("%s%d%d",st[i].s,&st[i].a,&st[i].b);
    16     }
    17     scanf("%d %d %d %d",&a,&b,&c,&d);
    18     for(i=0; i<n; i++)
    19     {
    20         for(j=0; j<n-1-i; j++)
    21         {
    22             if(st[j].a==st[j+1].a)
    23             {
    24                 if(st[j].b>st[j+1].b)t=st[j],st[j]=st[j+1],st[j+1]=t;
    25             }
    26             else if(st[j].a>st[j+1].a)t=st[j],st[j]=st[j+1],st[j+1]=t;
    27         }
    28     }
    29     for(i=0; i<n; i++)
    30     {
    31         if(st[i].a>=a&&st[i].a<=b)
    32         {
    33             if(st[i].b>=c&&st[i].b<=d)printf("%s %d %d
    ",st[i].s,st[i].a,st[i].b),cnt++;
    34         }
    35     }
    36     if(cnt==0)printf("No
    ");
    37 
    38     return 0;
    39 }
  • 相关阅读:
    C语言I博客作业02
    第一次作业
    C语言I博客作业07
    C语言I博客作业06
    C语言I博客作业05
    C语言I博客作业04
    C语言I博客作业03
    C语言I博客作业02
    课程目标
    具体方面
  • 原文地址:https://www.cnblogs.com/Angfe/p/10435943.html
Copyright © 2011-2022 走看看