$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 ;
}
随机推荐
- POJ-20407Relatives/NYOJ-333mdd的烦恼,欧拉函数简单应用,模板A
poj Relatives Time Limit: 1000MS Memory Li ...
- 学习使用windows下类似iptables的防火墙软件
项目地址:http://wipfw.sourceforge.net一.下载地址:http://sourceforge.net/projects/wipfw/files/安装:解压软件包后执行insta ...
- noip模拟赛 将军令
分析:对于前18个点可以考虑非常恶心的树形dp,不推荐这种方法.其实贪心还是很显然的.每个小队可以控制距离不超过k里的驿站,肯定要让这个k里不能白白浪费.对于所有叶子节点,如果它还没有被控制,那么肯定 ...
- 详解SpringBoot 添加对JSP的支持(附常见坑点)
序言: SpringBoot默认不支持JSP,如果想在项目中使用,需要进行相关初始化工作.为了方便大家更好的开发,本案例可直接作为JSP开发的脚手架工程 SpringBoot+War+JSP . 常见 ...
- msp430入门学习12
msp430的定时器--Timer_A(定时器A) msp430入门学习
- msp430入门学习00
在TI官网上找到MSP430的程序例程.数据手册.使用指南等文件.以MSP430F169为例,步骤如下: 1)进入ti官网:http://www.ti.com.cn/ 或者http://www.ti. ...
- u启动为苹果笔记本重装win7系统教程
准备更换系统的苹果笔记本一台! 上述需要准备的东西均准备好以后我们就开始今天的教程了!! 首先,将已经制作好启动盘的u启动u盘插入到苹果笔记本上的usb插口,然后开机! 由于苹果笔记本电脑 ...
- windows 7中添加新硬件的两种方法(本地回环网卡)
最近在windows7上使用VMwareWorkstation7玩一些实验,遇到需要配置不同网络的问题. 因为在windows2003server上习惯使用要本地回环网卡了,那就想着在Windows7 ...
- [TypeScript] Collect Related Strings in a String Enum in TypeScript
As of TypeScript 2.4, it is now possible to define string enums, or more precisely, enums with strin ...
- C#如何把写好的类编译成dll文件
1 新建一个类库项目 2 直接改写这个Class1.cs文件 3 记得要添加Windows.Forms引用 4 我直接把在别的项目中做好的cs文件搞到这里来,连文件名也改了(FilesDi ...