hdu 3554 Another Contest
来源:互联网 发布:数据分析专业 电脑推荐 编辑:程序博客网 时间:2024/05/11 14:56
简单模拟,关键在于排序。
#include <stdio.h>#include<string.h>#include<iostream>#define maxn 1005using namespace std;struct Node{int id,sum,n;}x[maxn];int tmp[maxn];bool cmp(Node a, Node b){ if(a.sum!=b.sum)return a.sum>b.sum; else if(a.n!=b.n)return a.n>b.n; else return a.id<b.id;}int main(){ int i, j, n, s, p, t,rank; while(scanf("%d%d%d", &n,&s,&p)!=EOF) { for(i=1; i<=s; i++) { x[i].id=i;x[i].sum=0;x[i].n=0; } for(i=1; i<=n; i++) { t=0; for(j=1; j<=s; j++) { scanf("%d", &tmp[j]); if(tmp[j]==0) t++; } for(j=1; j<=s; j++){ if(tmp[j]==1) { x[j].n++; x[j].sum+=t; } } } sort(x+1, x+s+1, cmp); for(i=1; i<=s; i++) { if(x[i].id==p) { printf("%d %d\n", x[i].sum, i); break; } } } return 0;}
- hdu 3554 Another Contest
- hdu 4960 Another OCD Patient 2014 Multi-University Training Contest 9
- DP+KMP——Another Meaning ( HDU 5763 ) ( 2016 Multi-University Training Contest 4 1001 )
- hdu 5763 Another Meaning(2016 Multi-University Training Contest 4——dp+kmp)
- hdu 3564 Another Lis
- HDU 5763 Another Meaning
- HDU 5763 Another Meaning
- HDU 5763 Another Meaning
- 【HDU】5763 Another Meaning
- hdu 5763 Another Meaning
- Another OCD Patient HDU
- HDU 2514 Another Eight Puzzle
- hdu 2514 Another Eight Puzzle
- hdu 2514 Another Eight Puzzle
- hdu 2514 Another Eight Puzzle
- HDU 2514 Another Eight Puzzle
- hdu 4647 Another Graph Game
- HDU 4647 Another Graph Game
- poj 3469 Dual Core CPU
- Servlet监听器介绍
- 七夕从期待变成陌生
- 删除一个字段的方法
- Android中获取PHP服务器端Json返回数据注意事项
- hdu 3554 Another Contest
- 坑爹的铁道部啊,排个鸟队啊
- “第一次亲密接触”--数据结构,迷宫的生成、走通(非递归)
- rpcbind服务 关闭
- 分享在rad 6中JSP 找不到某个JAR
- 如果不是异地
- android解析php输出的json格式字符串实例
- linux apache mysql php 源码安装总结(lamp)
- Java实现控制网口打印机并完成丢单重打机制