Argus LA3135


#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <algorithm>
#include <vector>
#include <cstring>
#include <stack>
#include <cctype>
#include <utility>   
#include <map>
#include <string>  
#include <climits> 
#include <set>
#include <string>    
#include <sstream>
#include <utility>   
#include <ctime>

using std::priority_queue;
using std::vector;
using std::swap;
using std::stack;
using std::sort;
using std::max;
using std::min;
using std::pair;
using std::map;
using std::string;
using std::cin;
using std::cout;
using std::set;
using std::queue;
using std::string;
using std::istringstream;
using std::make_pair;
using std::greater;
using std::endl;

struct NODE
{
	int Q, P, T;
};

struct COMP
{
	bool operator ()(const NODE &op1, const NODE &op2)
	{
		return op1.T == op2.T? (op1.Q > op2.Q): (op1.T > op2.T);
	}
};

char str[15];

priority_queue<NODE, vector<NODE>, COMP> que;

int main()
{
	NODE temp;
	temp.T = 0;
	while(scanf("%s", str), str[0] != '#')
	{
		scanf("%d%d", &temp.Q, &temp.P);
		temp.T = temp.P;
		que.push(temp);
	}
	int n;
	scanf("%d", &n);
	for(int i = 0; i < n; ++i)
	{
		temp = que.top();
		que.pop();
		printf("%d\n", temp.Q);
		temp.T += temp.P;
		que.push(temp);
	}
	return 0;
}


你可能感兴趣的:(Argus LA3135)