UVA Problem 12015 ( Google is Feeling Lucky) Solution

Problem Solving, UVa

 

#include <bits/stdc++.h>

using namespace std;

int main ( )

{

         char arr[101],a[101], b[101],c[101],d[101],

         e[101],f[101],g[101], h[101],in[101], jn[101];

         int val,i, tc,cases = 1 ;

         cin>>tc;

         while (tc--)

         {

             scanf ( "%s %d" , a ,&arr[0]);

             scanf ( "%s %d" , b ,&arr[1]);

             scanf ( "%s %d" , c ,&arr[2]);

             scanf ( "%s %d" , d ,&arr[3]);

             scanf ( "%s %d" , e ,&arr[4]);

             scanf ( "%s %d" , f ,&arr[5]);

             scanf ( "%s %d" , g ,&arr[6]);

             scanf ( "%s %d" , h ,&arr[7]);

             scanf ( "%s %d" , in ,&arr[8]);

             scanf ( "%s %d" , jn ,&arr[9]);

             val = 0 ;

             for ( i=0;i<10;i++ )

             {

                 if ( arr[i] > val )

                {

                     val= arr[i] ;

                }

             }

            

             cout<<"Case #"<<cases++<<":"<<endl;

            

             for(int j=0;j<10;j++)

             {

                 if(arr[j]==val)

                 {

                     if(j==0)

                     printf("%s\n",a);

                     if(j==1)

                     printf("%s\n",b);

                     if(j==2)

                     printf("%s\n",c);

                     if(j==3)

                     printf("%s\n",d);

                     if(j==4)

                     printf("%s\n",e);

                     if(j==5)

                     printf("%s\n",f);

                     if(j==6)

                     printf("%s\n",g);

                     if(j==7)

                     printf("%s\n",h);

                     if(j==8)

                     printf("%s\n",in);

                     if(j==9)

                     printf("%s\n",jn);

                 }

             }

                

        }

    

     return 0 ;

}

 

0 Comments

You may find interest following article

Complete Guide: Create Laravel Project in Docker Without Local Dependencies

Create Laravel Project Through Docker — No Need to Install PHP, MySQL, or Apache on Your Local Machine In this tutorial, I’ll show you how to create and run a full Laravel project using Docker containers. That means you won’t have to install PHP, MySQL, or Apache locally on your computer. By the end of this guide, you’ll have a fully functional Laravel development...