ZOJ 3770 Ranking System
来源:互联网 发布:seo黑帽工具有哪些 编辑:程序博客网 时间:2024/06/07 09:53
Few weeks ago, a famous software company has upgraded its instant messaging software. A ranking system was released for user groups. Each member of a group has a level placed near his nickname. The level shows the degree of activity of a member in the group.
Each member has a score based his behaviors in the group. The level is determined by this method:
- ⌊x⌋ is the maximum integer which is less than or equal to x.
- The member with the higher score will get the higher level. If two members have the same score, the earlier one who joined the group will get the higher level. If there is still a tie, the user with smaller ID will get the higher level.
Please write a program to calculate the level for each member in a group.
Input
There are multiple test cases. The first line of input is an integer T indicating the number of test cases. For each test case:
The first line contains an integer N (1 <= N <= 2000) indicating the number of members in a group.
The next N lines, each line contains three parts (separated by a space):
- The ID of the i-th member Ai (0 <= Ai <= 1000000000). The ID of each member is unique.
- The date of the i-th member joined the group, in the format of YYYY/MM/DD. The date will be in the range of [1900/01/01, 2014/04/06].
- The score Si (0 <= Si <= 9999) of the i-th member.
Output
For each test case, output N lines. Each line contains a string represents the level of the i-th member.
Sample Input
15123456 2011/03/11 308123457 2011/03/12 308333333 2012/03/18 4555555 2014/02/11 0278999 2011/03/18 308
Sample Output
LV3LV2LV2LV1LV2
#include <iostream>#include<string>#include<cstdio>#include<vector>#include<cstring>#include<algorithm>#include<map>using namespace std;struct node{ int i; int id; int yy,mm,dd; int score; string s;} p[2005];vector<node> v;bool cmp(node a,node b){ if(a.score!=b.score) return a.score<b.score; if(a.yy!=b.yy) return a.yy>b.yy; if(a.mm!=b.mm) return a.mm>b.mm; if(a.dd!=b.dd) return a.dd>b.dd; return a.id>b.id;}bool cmp1(node a,node b){ return a.i<b.i;}int main(){ int t; cin>>t; while(t--) { v.clear(); int n; cin>>n; int cnt=0; int cnt1=0; for(int i=0; i<n; i++) { scanf("%d %d/%d/%d %d",&p[i].id,&p[i].yy,&p[i].mm,&p[i].dd,&p[i].score); p[i].i=i; if(p[i].score==0) cnt1++; } sort(p,p+n,cmp); int num=n-cnt1; int ra[7]; ra[0]=0; ra[6]=num*3/100; ra[5]=num*7/100; ra[4]=num*20/100; ra[3]=num*30/100; for(int i=n-1; i>=0; i--) { if(p[i].score==0) p[i].s="LV1"; else { if(ra[6]>0) { p[i].s="LV6"; ra[6]--; continue; } if(ra[5]>0) { p[i].s="LV5"; ra[5]--; continue; } if(ra[4]>0) { p[i].s="LV4"; ra[4]--; continue; } if(ra[3]>0) { p[i].s="LV3"; ra[3]--; continue; } p[i].s="LV2"; } } sort(p,p+n,cmp1); for(int i=0; i<n; i++) cout<<p[i].s<<endl; } return 0;}
- ZOJ 3770 Ranking System
- ZOJ 3770 Ranking System
- ZOJ 3770 Ranking System
- ZOJ 3770 Ranking System 模拟
- ZOJ 3770 Ranking System(模拟)
- ZOJ-3770(Ranking System)
- ZOJ 3770 Ranking System(排序)
- 第14届浙江大学程序设计竞赛 D. Ranking System(ZOJ 3770)
- ZOJ 3770 : Ranking System (第14届浙江大学程序设计竞赛 D) - 结构体排序,vector
- Ranking System
- Ranking System
- D、Ranking System
- ZOJ3770:Ranking System
- ZOJ3770-Ranking System
- Ranking
- HLG 2120Ranking System【树状数组+map+二分】
- zoj 1088 System Overload
- zoj-1088-System Overload
- java配置jdk环境变量的问题
- 【洛谷P3697】开心派对小火车
- freemark
- socket与http的区别
- 面向对象高级之--利用纯面向对象和沙箱模式组织代码
- ZOJ 3770 Ranking System
- shell学习笔记
- Maven -- 依赖范围配置
- 【数值计算】数值解析--n元一次联立方程组:直接解法
- Java定时器小结
- linux 错误码
- QiYuAdmin-改造Quartz的Bean由SpringIOC容器管理(SpringBoot项目实战)
- 最新Banner(图片轮播)配置使用
- CRUD增删改查