首页 > 其他 > 详细

BaLaBaLa

时间:2015-08-12 21:31:42      阅读:136      评论:0      收藏:0      [点我收藏+]

#include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<algorithm>
using namespace std;

struct node
{
friend bool operator< (node n1, node n2)
{
if(n1.Time==n2.Time) return n2.ID<n1.ID;
return n2.Time<n1.Time;
}
int ID;
int Time;
};

int n,m;

int main()
{
while(~scanf("%d%d",&n,&m)){
priority_queue<node> Q;
for(int i=1;i<=n;i++)
{
node k;
k.ID=i;
k.Time=0;
Q.push(k);
}
for(int i=1;i<=m;i++)
{
int time;
scanf("%d",&time);
node k=Q.top();Q.pop();
if(i==m)
{
printf("%d\n",k.ID);
}
else
{
node h;
h.ID=k.ID;
h.Time=k.Time+time;
Q.push(h);
}
}
}
return 0;
}

BaLaBaLa

原文:http://www.cnblogs.com/zufezzt/p/4725424.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!