Pages

Thursday 13 September 2012

UVA - 12015 - Google is Feeling Lucky

#include <iostream>

using namespace std;

int main()
{
    int cases;
    string h="",temp="";
    cin >> cases;
    int max=-1,x;
    for(int i=1;i<cases+1;i++) {
        max=-1;
       for(int j=0;j<10;j++){
            cin>>temp>>x;
            if(x==max)
                h+= temp+"\n";
            if(x>max){
                h=temp+"\n";
                max=x;
            }
       }
       cout<<"Case #"<<i<<':'<<endl<<h;
    }
    return 0;
}

No comments:

Post a Comment