题目链接:http://acm.pku.edu.cn/JudgeOnline/problem?id=1177
<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />-->#include<iostream>
#include<algorithm>
#include<string>
usingnamespacestd;
constintMAX_SIZE=150;
structscore
{
intproblems;//解出的题数
stringtime;//用时
boolisTarget;//是否目标
};
structscorescores[MAX_SIZE];
intN,G,S,C,M,P;
boolcompare(constscore&s1,constscore&s2)
{
if(s1.problems>s2.problems)
{
returntrue;
}
elseif(s1.problems<s2.problems)
{
returnfalse;
}
else
{//题数相同,比较用时
if(s1.time.compare(s2.time)>0)
{
returnfalse;
}
elseif(s1.time.compare(s2.time)<0)
{
returntrue;
}
}
}
intfindTargetPos()
{//找到排序后的目标位置
intpos=-1;
for(inti=0;i<N;++i)
{
if(scores[i].isTarget==true)
{
pos=i;
break;
}
}
returnpos+1;
}
intmain()
{
inti,pos;
while(cin>>N>>G>>S>>C>>M)
{
if(N==0&&G==0&&S==0&&C==0&&M==0)break;
for(i=0;i<N;++i)
{
cin>>scores[i].problems>>scores[i].time;
scores[i].isTarget=false;
if(i==M-1)
{
scores[i].isTarget=true;
}
}
sort(scores,scores+N,compare);
pos=findTargetPos();
if(pos<=G)
{
cout<<"Acceptedtoday?I'vegotagoldenmedal:)"<<endl;
}
elseif(pos<=G+S)
{
cout<<"Acceptedtoday?I'vegotasilvermedal:)"<<endl;
}
elseif(pos<=G+S+C)
{
cout<<"Acceptedtoday?I'vegotacoppermedal:)"<<endl;
}
else
{
cout<<"Acceptedtoday?I'vegotanhonormentioned:)"<<endl;
}
}
return0;
}
分享到:
相关推荐
图论〔Graph Theory〕是数学的一个分支。它以图为研究对象。图论中的图是由若干给定的点及连接两点的线所构成的图形,这种图形通常用来描述某些事物之间的某种特定关系,用点代表事物,用连接两点的线表示相应两个...
avr学习板,可以自己试着焊一块电路板,加深自己对avr的初步认识
HDU的1250,主要是利用高精度加法,但是代码有点繁琐,效率不是很高
杭电ACMhdu1163
HDU1059的代码
hdu1001解题报告
hdu 1574 passed sorce
HDU的一题........HDU DP动态规
hdu2101AC代码
hdu acm 教案 搜索入门 hdu acm 教案 搜索入门
搜索 dfs 解题代码 hdu1241
hdu 5007 Post Robot 字符串枚举。 暴力一下就可以了。
hdu acm 教案 动态规划(1) hdu acm 教案 动态规划(1)
hdu 1166线段树代码
自己做的HDU ACM已经AC的题目
ACM HDU题目分类,我自己总结的大概只有十来个吧
HDU最全ac代码
HDU ACM 2005第几天 C++ http://acm.hdu.edu.cn/listproblem.php?vol=11 2005题 第几天?
hdu动态规划算法集锦