博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
"Accepted today?"
阅读量:4963 次
发布时间:2019-06-12

本文共 2704 字,大约阅读时间需要 9 分钟。

Problem Description
Do you remember a sentence "Accepted today?" Yes, the sentence is mentioned frequently in lcy's course "ACM Programming"! The contest is still in progress this moment. How excited it is! You, smart programmer, must have AC some problems today. "Can I get copper medal, silver medal, or even golden medal?" Oh, ha-ha! You must be considering this question. And now, the last problem of this contest comes. Give you all submitting data in the contest, and tell you the number of golden medals, silver medals and copper medals; your task is to output someone's contest result. Easy? Of course! I t is the reason that I designed the problem. When you have completed this contest, please remember that sentence〃 Accepted today?〃兒
 
Input
Input contains multiple test cases. Each test case starts with five numbers N (4 =< N <= 130 -- the total number of attendees), G, S, C (1<=G<=S<=C<N --G, S, C denoting the number of golden medals, silver medals and copper medals respectively) and M (0<M<=N). The next N lines contain an integer P (1<=P<=8 --number of problems that have been solved by someone) and a time T(for example,"02:45:17", meaning 2 hours and 45 minutes and 17 seconds consumed according to contest rules) each. You can assume that all submit data are different. A test case starting with 0 0 0 0 0 terminates input and this test case should not to be processed.
 
Output
For each case, print a sentence in a line, and it must be one of these sentences: Accepted today? I've got a golden medal :) Accepted today? I've got a silver medal :) Accepted today? I've got a copper medal :) Accepted today? I've got an honor mentioned :)
Note:
You will get an honor mentioned if you can't get copper medal, silver medal or golden medal.
 
Sample Input
10 1 2 3 6 2 02:45:17 2 02:49:01 2 03:17:58 2 03:21:29 4 07:55:48 3 04:25:42 3 06:57:39 2 02:05:02 2 02:16:45 2 02:41:37 0 0 0 0 0
#include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
struct lmx{
    int num;
    int ans;
    string s;
};
bool cmp(lmx sa, lmx ed)
{
    if(sa.ans!=ed.ans) return sa.ans>ed.ans;
    else return sa.s<ed.s;
}
lmx lm[135];
int main()
{
    string s;
    int n,i,a,b,c,m,cnt,fla;
    while(cin>>n>>a>>b>>c>>m)
    {
        if(a+n+b+c+m==0) break;
        for(i=0;i<n;i++)
        {
           cin>>lm[i].ans>>lm[i].s;
           lm[i].num=i+1;
        }
        sort(lm,lm+n,cmp);
        for(i=0;i<n;i++)
        {
            if(lm[i].num==m)  fla=i+1;
        }
        cout<<"Accepted today? ";
        if(fla<=a) cout<<"I've got a golden medal :)"<<endl;
        else if(fla<=a+b) cout<<"I've got a silver medal :)"<<endl;
        else if(fla<=a+b+c) cout<<"I've got a copper medal :)"<<endl;
        else cout<<"I've got an honor mentioned :)"<<endl;
    }
    return 0;
}

转载于:https://www.cnblogs.com/ffhuguang/archive/2013/06/14/3137009.html

你可能感兴趣的文章
GitLab修改时区
查看>>
翻译: Clustered Index Design Considerations 聚集索引设计注意事项
查看>>
Laravel Session保存机制和terminate中间件
查看>>
org.apache.catalina.util.DefaultAnnotationProcessor cannot be cast to org.ap解决方案
查看>>
以checked选中作为判断条件的各种写法
查看>>
Linux ln命令 - 建立文件/目录链接
查看>>
Httpservletrequest
查看>>
Jquery.ajax报parseerror Invalid JSON错误的原因和解决方法:不能解析
查看>>
杭电2602 Bone Collector
查看>>
数据库连接池的工作原理
查看>>
关于"××××程序集清单定义与程序集引用不匹配"问题的解决
查看>>
Unix和Linux的区别和联系
查看>>
计算机基础 python入门
查看>>
数据库那些事
查看>>
20150423 提问2
查看>>
Visual.Basic.NET项目开发实践pdf
查看>>
webservice远程测试显示 “测试窗体只能用于来自本地计算机的请求”
查看>>
DOM解析XML练习
查看>>
CF 118E Bertown roads 桥
查看>>
Combination Sum
查看>>