UVa 10258 - Contest Scoreboard
来源:互联网 发布:java 架构设计 编辑:程序博客网 时间:2024/05/16 12:34
题目:ACM比赛排版,出题数优先,然后是罚时(第一次AC的时间+AC前这个题目错的次数*20)。
(想起多年以前在学校写OJ的往事了╮(╯▽╰)╭)
分析:简单题,多级排序。直接按字符串读入数据,然后转化排序,输出即可。
注意:1.没有出题的的队伍也要排序;2.AC过的那道题再次提交不会产生影响。
#include <algorithm>#include <iostream>#include <cstdlib>#include <cstring>#include <cstdio>using namespace std;typedef struct nodec{int c,p,t;char L;}consists;consists I,C[105];int stats[105][11];//记录每个题目首次AC前的错误次数,如果AC赋值-1 bool cmp( consists a, consists b ){if ( a.p != b.p ) return a.p > b.p;if ( a.t != b.t ) return a.t < b.t;if ( a.c && b.c ) return a.c < b.c;return a.c > b.c;}int main(){int n;char buf[101];scanf("%d",&n);getchar();getchar();while ( n -- ) {memset( stats, 0, sizeof(stats) );memset( C, 0, sizeof(C) );while ( gets(buf) && buf[0] ) {sscanf(buf,"%d %d %d %c",&I.c,&I.p,&I.t,&I.L);C[I.c].c = I.c;//已经AC的题目 if ( stats[I.c][I.p] == -1 ) continue;//刚刚AC的题目 if ( I.L == 'C' ) {C[I.c].t += stats[I.c][I.p]*20+I.t;C[I.c].p ++;stats[I.c][I.p] = -1;continue;}//首次AC前的错误 if ( I.L == 'I' ) stats[I.c][I.p] ++;}sort( C+1, C+101, cmp );for ( int i = 1 ; C[i].c ; ++ i ) printf("%d %d %d\n",C[i].c,C[i].p,C[i].t);if ( n ) printf("\n");}//system("pause");return 0;}
0 0
- uva 10258 - Contest Scoreboard
- UVa 10258 - Contest Scoreboard
- UVA 10258 Contest Scoreboard
- UVA 10258 Contest Scoreboard
- UVa 10258 Contest Scoreboard
- UVa 10258 - Contest Scoreboard
- Uva 10258 Contest Scoreboard
- UVA 10258 Contest Scoreboard
- uva 10258Contest Scoreboard
- UVa OJ 10258 - Contest Scoreboard
- UVa Problem Solution: 10258 - Contest Scoreboard
- 10258 - Contest Scoreboard
- UVa Problem 10258 Contest Scoreboard (比赛计分板)
- Contest Scoreboard
- fjnu 1557 Contest Scoreboard
- 110207 Contest Scoreboard
- (挑战编程_2_7)Contest Scoreboard
- programming-challenges Contest Scoreboard (110207) 题解
- android acra错误日志上报
- 音频编解码·实战篇(1)PCM转至AAC(AAC编码)
- oracle
- tomcat下面web应用发布路径配置( 即虚拟目录配置 )
- poj 3155 Hard Life 分数规划+最大权闭合图
- UVa 10258 - Contest Scoreboard
- java字符串反转相关算法
- 好多书的读书笔记
- github入门资料
- apache配置https协议
- java byte转换代码块
- 条款21:必须返回对象时,别妄想返回其reference
- SVN如何清除用户信息重新登录
- 端午假期学ios