?? 1177 accepted today.cpp
字號:
/*
1177 "Accepted today?"
Time Limit : 1000 ms Memory Limit : 32768 K Output Limit : 5120 K
GUN C++
*/
#include <iostream.h>
//#include <fstream>
using namespace std;
const int NMAX=130;
int main()
{
char strout[4][50]={"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 :)"};
int n,g,s,c,m,ca;
int p,hour,min,sec,count;
int solvenum[NMAX]={0},medal[3];
float timecost[NMAX]={0},ptime;
//ifstream fin( "data.txt" );
while(cin>>n>>g>>s>>c>>m && n!=0)
{
medal[0]=g;medal[1]=s;medal[2]=c;
for(ca=0;ca<n;ca++)
{
//fin>>p>>hour;fin.ignore();fin>>min;fin.ignore();fin>>sec;
cin>>p>>hour;cin.ignore();cin>>min;cin.ignore();cin>>sec;
timecost[ca]=60*hour+min+(float)sec/60;
solvenum[ca]=p;
}
p=solvenum[m-1];ptime=timecost[m-1];count=0;
for(ca=0;ca<n;ca++)
{
if(ca!=m-1)
{
if(solvenum[ca]>p)
{ count++;continue;}
if(solvenum[ca]==p)
{
if(timecost[ca]<ptime)
{ count++;continue;}
}
}
}//for
for(ca=0;ca<3;ca++)
{
count-=medal[ca];
if(count<0)
{ break;}
}
cout<<strout[ca]<<endl;
}
//fin.close();
return 0;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -