http://acm.nefu.edu.cn/JudgeOnline/problemshow.php?problem_id=648
description |
Google is one of the most famous Internet search engines which hosts and develops a number of Internet-based services and products. On its search engine website, an interesting button “I’m feeling lucky” attracts our eyes. This feature could allow the user skip the search result page and goes directly to the first ranked page.
Amazing! It saves a lot of time.
The question is, when one types some keywords and presses “I’m feeling lucky” button, which web page will appear? Google does a lot and come up with excellent approaches to deal with it. In this simplified problem, let us just consider that Google assigns every web page an integer-valued relevance. The most related page will be chosen. If there is a tie, all the pages with the highest relevance are possible to be chosen.
Your task is simple, given 10 web pages and their relevance. Just pick out all the possible candidates which will be served to the user when “I’m feeling lucky”.
|
input |
|
output |
|
sample_input |
|
sample_output |
|
#include <string.h>
#include <stdio.h>
#include <iostream>
using namespace std;
struct note
{
int num;
char ch[102];
};
note a[12];
int main()
{
int n;
int k=1;
scanf("%d",&n);
while(n--)
{
int maxx=-11000;
for(int i=0;i<10;i++)
{
scanf("%s%d",a[i].ch,&a[i].num);
if(maxx<a[i].num)
maxx=a[i].num;
}
printf("Case #%d:\n",k++);
for(int i=0;i<10;i++)
if(a[i].num==maxx)
printf("%s\n",a[i].ch);
}
return 0;
}