juanjo12x

UVA_12015_Google_Feeling_Lucky

Jun 10th, 2014
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.50 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5.     char a[1000],b[1000],c[1000],d[1000],e[1000],f[1000],
  6.     g[1000],h[1000],i[1000],j[1000];
  7.     int n,k[1000],max,p,t=1;
  8.     while(scanf("%d",&n)==1)
  9.     {
  10.         while(n--)
  11.         {
  12.             scanf("%s%d",a,&k[0]);
  13.             scanf("%s%d",b,&k[1]);
  14.             scanf("%s%d",c,&k[2]);
  15.             scanf("%s%d",d,&k[3]);
  16.             scanf("%s%d",e,&k[4]);
  17.             scanf("%s%d",f,&k[5]);
  18.             scanf("%s%d",g,&k[6]);
  19.             scanf("%s%d",h,&k[7]);
  20.             scanf("%s%d",i,&k[8]);
  21.             scanf("%s%d",j,&k[9]);
  22.             max=0;
  23.             for(p=0;p<10;p++)
  24.             {
  25.                 if(k[p]>max)
  26.                 max=k[p];
  27.  
  28.             }
  29.             printf("Case #%d:\n",t++);
  30.             for(p=0;p<10;p++)
  31.             {
  32.                if(k[p]==max)
  33.                {
  34.                    if(p==0)
  35.                    puts(a);
  36.                    if(p==1)
  37.                    puts(b);
  38.                    if(p==2)
  39.                    puts(c);
  40.                    if(p==3)
  41.                    puts(d);
  42.                    if(p==4)
  43.                    puts(e);
  44.                    if(p==5)
  45.                    puts(f);
  46.                    if(p==6)
  47.                    puts(g);
  48.                    if(p==7)
  49.                    puts(h);
  50.                    if(p==8)
  51.                    puts(i);
  52.                    if(p==9)
  53.                    puts(j);
  54.                }
  55.             }
  56.         }
  57.     }
  58.     return 0;
  59. }
Add Comment
Please, Sign In to add comment