炒鸡\(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 ;
}

随机推荐

  1. 运算符、流程控制、while循环

    运算符: 1. 算术运算符: “ + ”.“ - ” .“ * ” .“ / ” 分别为加.减.乘.除. # % 是“取模运算符”,就是返回除法的余数.eg. a = 3, b=5, b % a 就是 ...

  2. Uva - 11181 Probability|Given (条件概率)

    设事件B为一共有r个人买了东西,设事件Ai为第i个人买了东西. 那么这个题目实际上就是求P(Ai|B),而P(Ai|B)=P(AiB)/P(B),其中P(AiB)表示事件Ai与事件B同时发生的概率,同 ...

  3. Ubuntu 16.04出现Can't open /etc/rc.d/init.d/functions的问题解决

    /etc/rc.d/init.d/functions是CentOS的位置,Ubuntu对应:/lib/lsb/init-functions 参考: https://unix.stackexchange ...

  4. JSP的EL表达式语言

    以下内容引用自http://wiki.jikexueyuan.com/project/jsp/expression-language.html: JSP表达式语言(EL)可以方便地访问存储在JavaB ...

  5. MySQL入门笔记 - 数据库概述

    参考书籍<MySQL入门很简单> 1.数据库 数据库(DataBase)是一个存储数据的仓库,将数据按照特定的规律存储在磁盘上. 2.数据存储方式 数据存储方式分为3个阶段:人工管理阶段. ...

  6. 什么是Wiki?

    Wiki一词来源于夏威夷语的“wee kee wee kee”, 发音wiki, 原本是“快点快点”的意思,被译为“维基”或“维客”.一种多人协作的写作工具.Wiki站点可以有多人(甚至任何访问者)维 ...

  7. AE After Effect 如何分段渲染

    如果只要第一段的话,你把要输出的那段首尾处分别按下B键和N键,这样输出时就会只输出这一段了(拖动首尾的栏目修改起始和终止的时间):如果是批量渲染的话你只要在这些不同的合成层里,每个按下ctrl+M键, ...

  8. react 项目实战(三)表单验证

    我们需要记录每一个字段当前的有效状态,有效时隐藏错误信息,无效时显示错误信息. 而这个有效/无效,可以在表单值改变的时候进行判断. 我们对/src/pages/UserAdd.js进行修改: 首先修改 ...

  9. vuejs快速入门

    参考链接:http://www.cnblogs.com/keepfool/p/5619070.html

  10. 工作总结 for 另类写法 循环加时间 集合合并 也是用的 static class Enumerable (IEnumerable<T>的扩展方法) (IEnumerable<T> 的 工具类) (所有集合 数组都实现IEnumerable<T>)

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...