HDOJ 1177 "Accepted today?" (简单模拟)
来源:互联网 发布:最后的晚餐 知乎 编辑:程序博客网 时间:2024/05/18 09:03
题目:
"Accepted today?"
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2319 Accepted Submission(s): 1029
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?〃兒
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.
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.
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 62 02:45:172 02:49:012 03:17:582 03:21:294 07:55:483 04:25:423 06:57:392 02:05:022 02:16:452 02:41:370 0 0 0 0
题意分析:
就是根据ACMrank的数据模拟出自己得的是金奖,银奖,铜奖还是安慰奖。多关键字排序,然后记录自己那个数据,然后算出排名求出自己得的什么奖。
代码:
#include <cstdio>#include <cstring>#include <algorithm>#include <iostream>#include <string>using namespace std;struct Node{ int p; string s; int id;} node[135];int cmp(Node x,Node y){ if(x.p!=y.p) return x.p>y.p; else return x.s<y.s;}int main(){ int N,G,S,C,M,temp; while(scanf("%d%d%d%d%d",&N,&G,&S,&C,&M)!=EOF) { if(N==0&&G==0&&S==0&&C==0&&M==0) break; for(int i=0; i<N; i++) { scanf("%d",&node[i].p); node[i].id=i+1; cin>>node[i].s; } sort(node,node+N,cmp); for(int i=0; i<N; i++) { if(node[i].id==M) temp=i+1; } if(temp<=G) printf("Accepted today? I've got a golden medal :)\n"); else if(temp<=G+S) printf("Accepted today? I've got a silver medal :)\n"); else if(temp<=G+S+C) printf("Accepted today? I've got a copper medal :)\n"); else printf("Accepted today? I've got an honor mentioned :)\n"); }}
0 0
- HDOJ 1177 "Accepted today?" (简单模拟)
- hdoj 1177 "Accepted today?"
- HDU 1177 ( "Accepted today?" )
- 1177"Accepted today?"
- HDU-1177"Accepted today?"
- hdu-1177-"Accepted today?"
- hdu1177("Accepted today?")
- 杭电1177-Accepted today
- HDU 1177 "Accepted today?" 水题
- HDU杭电 1177 Accepted today
- HDU1177:"Accepted today?"
- HDU--杭电--1177--"Accepted today?"--结构体排序
- HDU1177 "Accepted today?"
- hdu1177:"Accepted today?" 之基数排序
- HDOJ 4272 LianLianKan(简单模拟)
- hdoj 简单计算器 1237 (栈模拟)
- HDOJ Accepted Necklace
- HDOJ 2112 HDU Today (STL_map + dijkstra)
- Vuforia Virtual Button(虚拟按钮)案例一——按钮位置计算
- TCP协议通讯流程
- 重叠面积--扫描线 hdu1255 覆盖的面积
- HDU 2819 二分匹配
- 【阅读】《如何高效学习》第二章——整体性学习概览
- HDOJ 1177 "Accepted today?" (简单模拟)
- HDOJ 4941 Magical Forest
- 集合框架的总结
- TCP通信流程解析
- Xmind中文版使用教程:创建和使用思维导图模板
- centos 没有heartbeat包
- UML随笔
- one sentence i follow
- 1278 hdu 漂亮面料的设计