$CF19A World Football Cup$

炒鸡(6)批的模拟题。
注意的是输入
把握好空格 大小写。

根据题目的这句话来排序

积分榜是按照以下原则制作的:胜利一个队得3分,平分1分,失败0分。
首先,球队按积分顺序排在积分榜上,分数相等比较净胜球,净胜球相等比较进球数。

排序的话 根据 分数 净胜球 进球数来排序
反正就是明白输入之后就很简单了

// score - > win - > ball 分别表示 分数净胜球 进球数
#include <bits/stdc++.h>
#define rep(i,j,n) for(register int i=j;i<=n;i++)
#define Rep(i,j,n) for(register int i=j;i>=n;i--)
#define low(x) x&(-x)
using namespace std ;
typedef long long LL ;
const int inf = INT_MAX >> 1 ;
inline LL In() { LL res(0) , f(1) ; register char c ;
#define gc c = getchar()
    while(isspace(gc)) ; c == '-' ? f = - 1 , gc : 0 ;
    while(res = (res << 1) + (res << 3) + (c & 15) , isdigit(gc)) ;
    return res * f ;
#undef gc
}

const int N = 50 + 5 ;
int n ;
struct node {
	string name ;
	int score ;
	int win ;
	int ball ;
}a[N] ;
map < string , int > score , win , ball ;

bool cmp(node x , node y) {
	// score - > win - > ball
	if(x.score != y.score) return x.score > y.score ;
	else {
		if(x.win != y.win) return x.win > y.win ;
		return x.ball > y.ball ;
	}
}
bool cmp2(node x , node y) {
	return x.name < y.name ;
}
inline void Ot() {
	n = In() ;
	rep(i,1,n) {
		cin >> a[i].name ;
		a[i].score = a[i].ball = a[i].win = 0 ;
	}
	rep(i,1,n*(n-1) >> 1) {
		string s1 , s2 ;
		register char c ;
		//scanf("%s-%s %d:%d",&s1,&s2,&_1,&_2) ;
#define gc c = getchar()
		while(isspace(gc)) ;
		s1 += c ;
		while(islower(gc) or isupper(c)) s1 += c ;
		while(islower(gc) or isupper(c)) s2 += c ;
		int x = In() , y = In() ;
		if(x > y) score[s1] += 3 ;
		if(x == y) score[s1] ++ , score[s2] ++ ;
		if(x < y) score[s2] += 3 ;
		win[s1] += (x - y) , win[s2] += (y - x) ;
		ball[s1] += x , ball[s2] += y ;
	}
	rep(i,1,n) {
		a[i].score = score[a[i].name] ;
		a[i].ball = ball[a[i].name] ;
		a[i].win = win[a[i].name] ;
	}
	sort(a+1,a+n+1,cmp) ;
	sort(a+1,a+(n>>1)+1,cmp2) ;
	rep(i,1,(n>>1)) cout << a[i].name << endl ;
}
signed main() {
//  freopen("test.in","r",stdin) ;
    return Ot() , 0 ;
}

原文地址:https://www.cnblogs.com/qf-breeze/p/10700653.html