HDU 1084(水题)
来源:互联网 发布:js求数组最大值和下标 编辑:程序博客网 时间:2024/06/07 11:30
题意:如题。
#include<algorithm>#include<iostream>using namespace std;struct grade{ int no; int solves; int h; int m; int s; int score;};bool cmp(grade g1,grade g2){ if(g1.solves==g2.solves && g1.h==g2.h && g1.m==g2.m) return g1.s<g2.s; if(g1.solves==g2.solves && g1.h==g2.h) return g1.m<g2.m; if(g1.solves==g2.solves) return g1.h<g2.h; return g1.solves>g2.solves;}bool cmp2(grade g1,grade g2){ return g1.no<g2.no;}#define N 101grade G[N];grade H[N];int A[6];int K[6];int main(){ int n; while(scanf("%d",&n) && n!=-1) { memset(A,0,sizeof(A)); memset(K,0,sizeof(K)); int i; for(i=0;i<n;i++) { scanf("%d %d:%d:%d",&G[i].solves,&G[i].h,&G[i].m,&G[i].s); G[i].no=i; A[G[i].solves]++; } sort(G,G+n,cmp); for(i=0;i<n;i++) { if(G[i].solves==5 || G[i].solves==0) { G[i].score=50+G[i].solves*10; // printf("%d %d %d:%d:%d %d\n",G[i].no,G[i].solves,G[i].h,G[i].m,G[i].s,G[i].score); continue; } int t=50+G[i].solves*10; if(K[G[i].solves]<A[G[i].solves]/2) t+=5; K[G[i].solves]++; G[i].score=t; // printf("%d %d %d:%d:%d %d\n",G[i].no,G[i].solves,G[i].h,G[i].m,G[i].s,G[i].score); } sort(G,G+n,cmp2); for(i=0;i<n;i++) { printf("%d\n",G[i].score); } printf("\n"); } return 0;}
0 0
- hdu 1084 水题
- HDU 1084(水题)
- hdu 1084 水题
- hdu 1084
- hdu-1084
- HDU-1084
- hdu水题
- hdu 水题
- hdu 1084 What Is Your Grade(水题)
- hdu 1084 course
- HDU 1800(水题!!! @@)
- hdu 1231 DP水题
- HDU 2114 水题
- 水题 hdu 1070 milk
- HDU-1012 水题
- hdu 1029 计数 水题
- HDU-1040(水题)
- HDU 4081 prim水题
- [转载]获取汉语拼音
- 关于iOS中的一些错误集
- Android 实现全屏 无标题栏
- oracle 两表数据对比---minus
- Matlab学习笔记之一
- HDU 1084(水题)
- 设计模式六大原则(5):迪米特原则
- Access Control List and Process(如何设置DACL)
- 代理模式----代理追求者
- 遇过的坑-用ant编译java项目,如果static变量有修改,使用了该static变量的java文件, 不会重编译
- 跨站脚本攻击—shellcode
- Android学习笔记<20140113> Internal Storage
- ubuntu文本编码转换工具iconv
- 小强的HTML5移动开发之路(19)——HTML5 Local Storage(本地存储)