Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

没意义

Posted by donkeyinacm at 2010-03-05 12:59:20 on Problem 2051
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator