Description:
In the autumn of this year, two Russian teams came into the group stage of the most prestigious football club competition in the world — the UEFA Champions League. Now, these teams have already started to play in the group stage and are fighting for advancing to the playoffs. In this problem we are interested in the draw stage, the process of sorting teams into groups.
就是题意难懂,读懂题意直接吗,模拟。
加上读写文件。
AC代码:
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdlib.h>
#include<queue>
#include<map>
#include<vector>
#include<math.h>
const int INF = 0x3f3f3f3f;
using namespace std;
typedef long long ll;
typedef double ld;
struct node
{
char name[25];
int rating;
}team[70];
int n,m,x,y,a,b,c;
bool used[70];
bool cmp(node a,node b)
{
return a.rating>b.rating;
}
int main()
{
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
int i,g,k,j,h,num;
scanf("%d%d%d%d%d",&n,&x,&a,&b,&c);
for (i=0;i<n;i++) scanf("%s%d",team[i].name,&team[i].rating);
sort(team,team+n,cmp);
m=n/4;
memset(used,false,sizeof(used));
for (g=0;g<m;g++)
{
printf("Group %c:\n",'A'+g);
for (k=0;k<4;k++)
{
y=(x*a+b)%c;
x=y;
h=x%(m-g);
num=-1;
for (j=k*m;;j++)
if (!used[j])
{
num++;
if (num==h) break;
}
used[j]=true;
puts(team[j].name);
}
}
return 0;
}