PAT_(队列应用) 1056 Mice and Rice

1056 Mice and Rice (25分)

Mice and Rice is the name of a programming contest in which each programmer must write a piece of code to control the movements of a mouse in a given map. The goal of each mouse is to eat as much rice as possible in order to become a FatMouse.

First the playing order is randomly decided for N​P​​ programmers. Then every N​G​​ programmers are grouped in a match. The fattest mouse in a group wins and enters the next turn. All the losers in this turn are ranked the same. Every N​G​​ winners are then grouped in the next match until a final winner is determined.

For the sake of simplicity, assume that the weight of each mouse is fixed once the programmer submits his/her code. Given the weights of all the mice and the initial playing order, you are supposed to output the ranks for the programmers.

题目大意:就是说有np只老鼠,每ng只mouse分为一组,每组选出最重的那只,晋级下一轮,直到最终的winner产生

 

#include
#include
#include
#include
#include
#include
#include
#define maxn 1010
using namespace std;
struct node{
	int weight;
	int rank;
}pre[maxn];
queue qu;
int main(){
	int np,ng,order; //11个num,3个一组 
	scanf("%d%d",&np,&ng);
	for(int i=0;i=num) break; //针对最后一组 
				int first=qu.front();
				if(pre[k].weight

 

 

 

你可能感兴趣的:(pat)