"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 ...
随机推荐
- XMPP框架下微信项目总结(8)图片发送
前言:“图片”发送和“聊天文本”都是通过模块发起的成为:“消息模块”(反正传递的都是字符串) 发送原理: 1 current客户端获取本地图片 2 xmpp发送“字符串”(为什么是字符串?1: ...
- WdatePicker 开始日期不能大于结束日期,结束时间不能小于开始时间
<input class="input_calendar inputcss" id="startDate" runat="server" ...
- 【JAVA多线程概述】
一.多线程概述 一个进程中至少有一个线程,每一个线程都有自己运行的内容,这个内容可以称为线程要执行的任务. 不能没一个问题都使用多线程,能使用单线程解决的问题就不要使用多线程解决. 使用多线程的弊端: ...
- C++Primer快速浏览笔记-类型转换
bool b = 42; // _b is true_ int i = b; // _i has value 1_ i = 3.14; // _i has value 3_ double pi = i ...
- 字幕文件 WebVTT 与 srt 之间的互相转化
1. WebVTT 2 srt 1. 用记事本打开 .vtt 文件: 2. 在记事本中点击 编辑 -> 替换 -> 查找内容中输入".",替换为中输入",& ...
- JAVA的容器---List,Map,Set (转)
JAVA的容器---List,Map,Set Collection├List│├LinkedList│├ArrayList│└Vector│ └Stack└SetMap├Hashtable├HashM ...
- pythonchallenge之C++学习篇-01
字符处理时每个语言都具备的一种功能,其中还有一些语言因此出名,比如perl,shell,还有一些函数式的编程语言 C语言中的字符串与数组和指针联系的比较紧密,因此可以这样生命字符串*p="h ...
- Emacs 之窗口管理
// */ // ]]> Emacs 之窗口管理 Table of Contents 1. Emacs 窗口相关 1.1. Emacs 里调整 window 大小 1.2. Emacs winn ...
- ubuntu安装shadowshocks-qt5
sudo add-apt-repository ppa:hzwhuang/ss-qt5 sudo apt-get update sudo apt-get install shadowsocks-qt5 ...
- asp.net权限控制配置web.config
项目下 有三个文件夹 A,B,C 验正方式是 Forms 验正 我要设置他们的访问权限为, A,匿名可访问 B,普通用户授权后才能访问 C,只允许管理员访问 <configuration> ...