hdu 2093 考试排名
来源:互联网 发布:p站软件 编辑:程序博客网 时间:2024/05/17 00:47
#include <stdio.h>#include <algorithm>#include <string.h>using namespace std;struct STU{ char name[20]; int sum; int cnt;} s[1000];int cmp(STU x,STU y)//先按题数排,再按总时间小的在头排序{ if(x.cnt!=y.cnt) return x.cnt>y.cnt; return x.sum<y.sum;}int main(){ int n,t; while(~scanf("%d%d",&n,&t)) { int i,j,k = 0; char sc[100]; while(~scanf("%s",s[k].name)) { s[k].sum = s[k].cnt = 0; for(i = 0; i<n; i++) { scanf("%s",sc); if(!strcmp(sc,"0"))//没提交,自然不算 continue; if(sc[0] == '-')//提交的都是错的,而且没A,也不算 continue; s[k].cnt++; int len = strlen(sc),f = 0,l = 0; if(!strstr(sc,"("))//没有括号代表1A,,直接算 { while(sc[l]) { f = f*10+sc[l]-'0'; l++; } s[k].sum+=f; continue; } while(sc[l]!='(')//有括号就要算出提交的时间 { f = f*10+sc[l]-'0'; l++; } s[k].sum+=f; f = 0; l++; while(sc[l]!=')')//罚时 { f = f*10+sc[l]-'0'; l++; } f = f*t; s[k].sum+=f; } k++; } sort(s,s+k,cmp); for(i = 0; i<k; i++) { printf("%-10s%3d%5d\n",s[i].name,s[i].cnt,s[i].sum); } } return 0;}
0 0
- hdu 2093 考试排名
- HDU 2093 - 考试排名
- HDU 2093 考试排名
- HDU 2093 考试排名
- hdu 2093 考试排名
- HDU 2093 考试排名
- HDU 2093 考试排名
- hdu 2093 考试排名
- hdu 2093 考试排名
- HDU 2093考试排名
- hdu---2093考试排名
- HDU考试排名2093
- 【HDU 2093】考试排名
- HDU 2093 考试排名
- hdu 2093 考试排名
- 【hdu 2093】 考试排名
- HDU 2093 考试排名
- HDU 2093 考试排名
- Jedis+spring集成
- 极客以折腾不息的树莓派玩法
- HDU 2141 Can you find it?(暴力+二分)
- UIImagePickerController简单使用
- mongodb 常用查询语句整理
- hdu 2093 考试排名
- [ZJOI2014][JZOJ3617]力
- 多线程死锁问题
- Merkel Under Pressure After Migrant Influx
- leetcode笔记:H-Index II
- Future和FutureTask区别
- centos7下安装fastdfs
- 转场动画 学习
- 我的CentOS环境部署过程:从vmware安装到环境搭建