HDU考试排名2093
来源:互联网 发布:linux硬件时间 编辑:程序博客网 时间:2024/05/17 02:27
一开始学习的时候以为巨难的题目
后来看过的题目多了现在就可以一次AC了
考试排名
#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>using namespace std;struct node{ int AC; int WA; int fashi; char name[200];};bool cmp(node A,node B){ if(A.AC==B.AC&&B.fashi==A.fashi) return strcmp(A.name,B.name)<0; else if(A.AC==B.AC) return A.fashi<B.fashi; return A.AC>B.AC;}int main(){ int n,fenshu; node s[200]; int ok=0;char SS[200]; int len; scanf("%d%d",&n,&fenshu); getchar(); while(scanf("%s",s[ok].name)!=EOF) { s[ok].fashi=s[ok].AC=s[ok].WA=0; for(int i=0;i<n;i++) { scanf("%s",SS); if(strcmp(SS,"0")==0) continue; else if(SS[0]=='-'||SS[0]=='0') { continue; } else if(SS[0]!='-'&&(SS[0]>='0'&&SS[0]<='9')) { s[ok].AC+=1; int sum=0;int place=0; sum+=SS[0]-'0'; bool flag=false; len=strlen(SS); for(int ol=1;ol<len;ol++) { if(SS[ol]>='0'&&SS[ol]<='9') { sum=sum*10+SS[ol]-'0'; // printf("fdsf%d\n",sum); } else if(SS[ol]=='(') { place=ol; flag=true; break; } } s[ok].fashi+=sum;sum=0; if(flag) for(int ol=place+1;ol<len;ol++) { if(SS[ol]==')') break; else if(SS[ol]>='0'&&SS[ol]<='9') sum=sum*10+SS[ol]-'0'; //printf("hereisthesumof%d\n",sum); } s[ok].fashi+=(sum*fenshu); //printf("%d\n",s[ok].fashi); } } //printf("%dfashi =%d\n",ok,s[ok].fashi); ok+=1; } sort(s,s+ok,cmp); int i; for(i=0;i<ok;i++) { printf("%-10s %2d %4d",s[i].name,s[i].AC,s[i].fashi); cout<<endl; } 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 考试排名
- Android中关于Adapter的使用(中)SimpleAdapter
- 几种计算机语言的不同 (知乎)
- A free software for easily creating setups
- HDOJ 1325 Is It A Tree?(并查集)
- uva 12627 - Erratic Expansion 找规律,递归
- HDU考试排名2093
- php抓取中文字符
- JavaScript常用对象
- Ajax xmlHttpRequest的status的值的含义
- js数组元素删除操作
- PHP $_SERVER['SCRIPT_FILENAME'] 与 __FILE__ 的区别
- EJB学习笔记七(依赖注入)
- 二维线段树UVA11297
- Python PIL 图片添加水印