每筆測資有十個網址,將十個網址中具有最大值的網址們印出即可。
C++(0.000)
/*******************************************************/
/* UVa 12015 Google is Feeling Lucky */
/* Author: Maplewing [at] knightzone.studio */
/* Version: 2016/03/14 */
/*******************************************************/
#include <iostream>
#include <cstdio>
#include <climits>
#include <string>
#include <vector>
using namespace std;
int main(){
const int URL_NUMBER = 10;
int T;
while( scanf("%d", &T) != EOF ){
for( int i = 1 ; i <= T ; ++i ){
vector<string> urls;
int maxRelevance = INT_MIN;
string url;
int relevance;
for( int j = 0 ; j < URL_NUMBER ; ++j ){
cin >> url;
scanf("%d", &relevance);
if( relevance > maxRelevance ){
maxRelevance = relevance;
urls.clear();
urls.push_back(url);
}
else if( relevance == maxRelevance ){
urls.push_back(url);
}
}
printf("Case #%d:\n", i);
for( int j = 0 ; j < urls.size() ; ++j ){
printf("%s\n", urls[j].c_str());
}
}
}
return 0;
}