"Accepted today?"[HDU1177]
"Accepted today?"
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 2832 Accepted Submission(s):
1290
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?〃兒
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.
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.
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 <algorithm>
using namespace std; struct AC
{
int num,h,m,s;
int no;
int k;//k=1金,2银,3铜,4,安慰奖
} a[]; int cmp(AC x,AC y)
{
if(x.num!=y.num)
return x.num>y.num;
if(x.h!=y.h)
return x.h<y.h;
if(x.m!=y.m)
return x.m<y.m;
return x.s<y.s;
} int main()
{
int n,g,s,c,m,i;
while(~scanf("%d%d%d%d%d",&n,&g,&s,&c,&m))
{
if(n+g+s+m+c == )
break;
for(i = ; i<n; i++)
{
a[i].no = i+;
scanf("%d %d:%d:%d",&a[i].num,&a[i].h,&a[i].m,&a[i].s);
}
sort(a,a+n,cmp);
//printf("====\n");
for(i = ; i<n; i++)
{
if(g)
{
a[i].k = ;
g--;
}
else if(s)
{
a[i].k = ;
s--;
}
else if(c)
{
a[i].k = ;
c--;
}
else
{
a[i].k = ;
}
}
for(i = ; i<n; i++)
{
if(a[i].no == m)
{
if(a[i].k == )
printf("Accepted today? I've got a golden medal :)\n");
else if(a[i].k == )
printf("Accepted today? I've got a silver medal :)\n");
else if(a[i].k == )
printf("Accepted today? I've got a copper medal :)\n");
else if(a[i].k == )
printf("Accepted today? I've got an honor mentioned :)\n");
break;
}
}
} return ;
}
"Accepted today?"[HDU1177]的更多相关文章
- How to Fix GNOME License Not Accepted Issue on CentOS 7
This post assume that you have just finished the Gnome GUI installation on CentOS 7 by using “yum gr ...
- Spark优化之二:集群上运行jar程序,状态一直Accepted且不停止不报错
如果运行Spark集群时状态一直为Accepted且不停止不报错,比如像下面这样的情况: 15/06/14 11:33:33 INFO yarn.Client: Application report ...
- mapreduce作业状态一直是ACCEPTED
搭建yarn环境后,执行 hadoop/bin/hadoop jar hadoop/share/hadoop/mapreduce/hadoop-mapreduce-examples-2.4.1.jar ...
- centos7安装出现license information(license not accepted)解决办法
若出现license information(license not accepted),即说明需要同意许可信息,输入1-回车-2-回车-c-回车-c回车,即可解决.
- Accepted Necklace
Accepted Necklace Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) T ...
- SubsetsTotal Accepted:49746Total Submissions:176257My Submissions
Subsets Total Accepted: 49746 Total Submissions: 176257My Submissions Given a set of distinct intege ...
- hdu 2660 Accepted Necklace
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=2660 Accepted Necklace Description I have N precious ...
- spark on yarn :state: ACCEPTED一直 出现
今天运行spark on yarn 一直出现 16/09/20 18:40:41 INFO yarn.Client: Application report for application_147417 ...
- Spark之submit任务时的Initial job has not accepted any resources; check your cluster UI to ensure that workers are registered and have sufficient memory
Spark submit任务到Spark集群时,会出现如下异常: Exception 1:Initial job has not accepted any resources; check your ...
随机推荐
- Linux 中文乱码问题解决
本文转载自:http://linux-wiki.cn/wiki/zh-hans/Java%E7%A8%8B%E5%BA%8F%E4%B8%AD%E6%96%87%E5%AD%97%E4%BD%93%E ...
- Android-----overridePendingTransition的使用
1 Activity的切换动画指的是从一个activity跳转到另外一个activity时的动画. 它包括两个部分:一部分是第一个activity退出时的动画:另外一部分时第二个activity进入时 ...
- js冒泡排序与二分法查找
冒泡排序 var attr=[1,5,7,6,3,9,2,8,4]; var zj=0; //控制比较轮数 for(var i=0;i<attr.length-1;i++) { //控制每轮的比 ...
- 基于spring4.0配置分布式ehcache,以及相关使用
说明:本文是基于RMI手动同步的方式,使用程序动态注入配置缓存,抛弃传统的ehcache.xml配置方式 1,注入cacheManager管理所有缓存,添加各个缓存名及相关参数配置: 思路大致是: 在 ...
- .NET开发工具之Excel导出公共类
来源:Pino晨 链接:cnblogs.com/chenxygx/p/5954870.html 说明 最近接了一个任务,就是做一个列表的Excel导出功能.并且有很多页面都会使用这个功能. 导出的Ex ...
- C# 文件读取方法,自己写的例子,保存一下,备用
/// <summary> /// 将output.config内容传到app.config /// </summary> string ReadString; //两个地址 ...
- C# 拓展方法
/// <summary> /// 扩展类 /// </summary> public static class Extend { /// <summary> // ...
- JavaScript中Eval()函数的作用
这一周感觉没什么写的,不过在研究dwz源码的时候有一个eval()的方法不是很了解,分享出来一起学习 -->首先来个最简单的理解 eval可以将字符串生成语句执行,和SQL的exec()类似. ...
- HDU 1540 Tunnel Warfare 平衡树 / 线段树:单点更新,区间合并
Tunnel Warfare Time Limit: 4000/2000 MS (Java/Others) Memory Lim ...
- Oracle资源
ORACLE 10g下载地址 oracle 下载还需要用户名我自己注册了个方便大家使用下载 user:1603869780@qq.compass:qwe123QWE现在直接点击不能下载了 要经过ora ...