UVALive - 3135 B - Argus

题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=1136

优先队列,设定一下优先级就好!

#include
#include
#include
using namespace std;
struct Argus
{
    int q,p,s;
    bool operator<(const Argus&A)const
    {
        return A.s que;
    while(scanf("%s",s)!=EOF)
    {
        if(s[0]=='#')
            break;
        scanf("%d%d",&a.q,&a.p);
        a.s=a.p;
        que.push(a);
    }
    scanf("%d",&n);
    while(n--)
    {
        a=que.top();
        printf("%d\n",a.q);
        que.pop();
        a.s+=a.p;
        que.push(a);
    }

}

你可能感兴趣的:(日常)