nefu 648 大水题

来源:互联网 发布:pdf语音朗读软件 编辑:程序博客网 时间:2024/04/25 08:47

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

The input contains multiple test cases. The number of test cases T is in the first line of the input file.     For each test case, there are 10 lines, describing the web page and relevance. Each line contains a character string without any blank characters denoting the URL of this web page and an integer Vi denoting the relevance of this web page. The length of the URL is between 1 and 100 inclusively. (1<=Vi<=100)

output

 For each test case, output several lines which are the URLs of the web pages which are possible to be chosen. The order of the URLs is the same as the input.     Please look at the sample output for further information of output format.

sample_input

2www.youtube.com 1www.google.com 2www.google.com.hk 3www.alibaba.com 10www.taobao.com 5www.bad.com 10www.good.com 7www.fudan.edu.cn 8www.university.edu.cn 9acm.university.edu.cn 10www.youtube.com 1www.google.com 2www.google.com.hk 3www.alibaba.com 11www.taobao.com 5www.bad.com 10www.good.com 7www.fudan.edu.cn 8www.university.edu.cn 9acm.university.edu.cn 10

sample_output

Case #1:www.alibaba.comwww.bad.comacm.university.edu.cnCase #2:www.alibaba.com
#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;}


0 0
原创粉丝点击