⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 1177 accepted today.cpp

📁 威士忌的HDU题解.大概有260多题的源码。对于学习非常有好处。
💻 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 + -