Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
没意义#include <iostream> #include <queue> using namespace std; class command { public: int time,id,t; friend bool operator<(command a,command b) { if(a.time==b.time) return a.id>b.id; return a.time>b.time; } }; priority_queue<command> que; int main() { //freopen("c:/aaa.txt","r",stdin); command com; char str[10]; int k; while(scanf("%s",str)&&str[0]!='#') { scanf("%d%d",&com.id,&com.t); com.time=com.t; que.push(com); } scanf("%d",&k); while(k--) { com=que.top(); que.pop(); printf("%d\n",com.id); com.time+=com.t; que.push(com); } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator