Applications----模拟
来源:互联网 发布:vb语言程序设计是什么 编辑:程序博客网 时间:2024/05/14 02:32
Recently, the ACM/ICPC team of Marjar University decided to choose some new members from freshmen to take part in the ACM/ICPC competitions of the next season. As a traditional elite university in ACM/ICPC, there is no doubt that application forms will fill up the mailbox. To constitute some powerful teams, coaches of the ACM/ICPC team decided to use a system to score all applicants, the rules are described as below. Please note that the score of an applicant is measured by pts, which is short for "points".
1. Of course, the number of solved ACM/ICPC problems of a applicant is important. Proudly, Marjar University have a best online judge system called Marjar Online Judge System V2.0, and in short, MOJ. All solved problems in MOJ of a applicant will be scored under these rules:
- (1) The problems in a set, called MaoMao Selection, will be counted as 2.5 pts for a problem.
- (2) The problems from Old Surgeon Contest, will be counted as 1.5 pts for a problem.There is no problem in MaoMao Selection from Old Surgeon Contest.
- (3) Besides the problem from MaoMao Selection and Old Surgeon Contest, if the problem's id is a prime, then it will be counted as 1 pts.
- (4) If a solved problem doesn't meet above three condition, then it will be counted as 0.3 pts.
2. Competitions also show the strength of an applicant. Marjar University holds the ACM/ICPC competition of whole school once a year. To get some pts from the competition, an applicant should fulfill rules as below:
- The member of a team will be counted as 36 pts if the team won first prize in the competition.
- The member of a team will be counted as 27 pts if the team won second prize in the competition.
- The member of a team will be counted as 18 pts if the team won third prize in the competition.
- Otherwise, 0 pts will be counted.
3. We all know that some websites held problem solving contest regularly, such as JapanJam, ZacaiForces and so on. The registered member of JapanJam will have a rating after each contest held by it. Coaches thinks that the third highest rating in JapanJam of an applicant is good to show his/her ability, so the scoring formula is:
Here r is the third highest rating in JapanJam of an applicant.
4. And most importantly - if the applicant is a girl, then the score will be added by 33 pts.
The system is so complicated that it becomes a huge problem for coaches when calculating the score of all applicants. Please help coaches to choose the best M applicants!
Input
There are multiple test cases.
The first line of input is an integer T (1 ≤ T ≤ 10), indicating the number of test cases.
For each test case, first line contains two integers N (1 ≤ N ≤ 500) - the number of applicants and M (1 ≤ M ≤ N) - the number of members coaches want to choose.
The following line contains an integer R followed by R (0 ≤ R ≤ 500) numbers, indicating the id of R problems in MaoMao Selection.
And then the following line contains an integer S (0 ≤ S ≤ 500) followed by S numbers, indicating the id of S problems from Old Surgeon Contest.
The following line contains an integer Q (0 ≤ Q ≤ 500) - There are Q teams took part in Marjar University's competition.
Following Q lines, each line contains a string - team name and one integer - prize the team get. More specifically, 1 means first prize, 2 means second prize, 3 means third prize, and 0 means no prize.
In the end of each test case, there are N parts. In each part, first line contains two strings - the applicant's name and his/her team name in Marjar University's competition, a char sex - M for male, F for female and two integers P (0 ≤ P ≤ 1000) - the number of problem the applicant solved, C (0 ≤ C ≤ 1000) - the number of competitions the applicant have taken part in JapanJam.
The following line contains P integers, indicating the id of the solved problems of this applicant.
And, the following line contains C integers, means the rating for C competitions the applicant have taken part in.
We promise:
- The problems' id in MaoMao Selection, Old Surgeon Contest and applicant's solving list are distinct, and all of them have 4 digits (such as 1010).
- All names don't contain spaces, and length of each name is less than 30.
- All ratings are non-negative integers and less than 3500.
Output
For each test case, output M lines, means that M applicants and their scores. Please output these informations by sorting scores in descending order. If two applicants have the same rating, then sort their names in alphabet order. The score should be rounded to 3 decimal points.
Sample Input
15 33 1001 1002 10034 1004 1005 1006 10073MagicGirl!!! 3Sister's_noise 2NexusHD+NexusHD 1Edward EKaDiYaKanWen M 5 31001 1003 1005 1007 10091800 1800 1800FScarlet MagicGirl!!! F 3 51004 1005 10071300 1400 1500 1600 1700A NexusHD+NexusHD M 0 0B None F 0 0IamMM Sister's_noise M 15 11001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 10153000
Sample Output
FScarlet 60.000IamMM 44.300A 36.000题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3705
好难的一个模拟,其实规则很简单,就是题目太长了......完虐我这种英语渣,读题读了3遍才懂得题......
题目的说有四个规则:
1、平常做题的题号,分为四类:MaoMao Selection,Old Surgeon Contest ,题号为质数的问题,一般问题,有不同的权值。这几项没有冲突。
2、校赛排名加分,给出队伍名和名次。
3、japanjam的加权分数,要求是第三高的分数,找到第三高的分数代入公式。
4、女生加33分。
把这四个小方面合起来就是这个题了。
代码:
#include <cstdio>#include <iostream>#include <cstring>#include <string>#include <cmath>#include <algorithm>#include <iomanip>using namespace std;int MaoMao[505];int old[505];int maomaonum,oldnum;int level[1050];struct node{ string name; string team; char sex; double score;}xin[600];struct com{ string team; int ranker;}xin2[600];bool isprime(int n){ int k=(int )sqrt(n); for (int i=2;i<=k;i++){ if (n%i==0) return false; } return true;}bool ismaomao(int id){for(int i=0;i<maomaonum;i++){if(id==MaoMao[i])return true;}return false;}bool isold(int id){for(int i=0;i<oldnum;i++){if(id==old[i])return true;}return false;}double MAX(double a,double b){ return a>b?a:b;}double gongshi(int r){return MAX(0,((r-1200)/100.0)*1.5);}bool cmp(struct node a,struct node b){return a.score>b.score;}bool cmp1(int a,int b){return a>b;}int main(){int t;scanf("%d",&t);while(t--){ memset(MaoMao,0,sizeof(MaoMao));memset(old,0,sizeof(old));int N,M,tmp;string tmp2;int Num;scanf("%d%d",&N,&M);scanf("%d",&maomaonum);for(int i=0;i<maomaonum;i++){ scanf("%d",&MaoMao[i]);} scanf("%d",&oldnum);for(int i=0;i<oldnum;i++){scanf("%d",&old[i]);}scanf("%d",&Num);for(int i=0;i<Num;i++){cin>>xin2[i].team>>xin2[i].ranker;}for(int i=0;i<N;i++){memset(level,0,sizeof(level));string Name;int score,ss,NUM;double res=0;cin>>xin[i].name>>Name>>xin[i].sex>>ss>>NUM;xin[i].team=Name;if(xin[i].sex=='F')res+=33;for(int k=0;k<ss;k++){scanf("%d",&tmp);if(ismaomao(tmp)==1){res+=2.5;}else if(isold(tmp)==1){res+=1.5;}else if(isprime(tmp)==1){res+=1;}else{res+=0.3;}}for(int t=0;t<Num;t++){if(Name==xin2[t].team){if(xin2[t].ranker==1){res+=36;}else if(xin2[t].ranker==2){res+=27;}else if(xin2[t].ranker==3){res+=18;}}}for(int p=0;p<NUM;p++){ scanf("%d",&level[p]);}sort(level,level+NUM,cmp1);score=level[2];res+=gongshi(score);xin[i].score=res; } //cout<<"----------"<<endl; sort(xin,xin+N,cmp); for(int a=0;a<M;a++){ cout<<xin[a].name<<" "<<setiosflags(ios::fixed)<<setprecision(3)<<xin[a].score<<endl; }}return 0;}
写了我一个多小时
- Applications----模拟
- zoj3705 Applications 【简单模拟】
- zoj3705 Applications 模拟题
- ZOJ 3705Applications (模拟)
- ZOJ 3705 Applications (模拟)
- zoj 3705 Applications(较复杂的模拟)
- zoj 3705 Applications(粗暴模拟题)
- ZOJ 3705 Applications(模拟题)
- Applications
- ZOJ 3705 10th 省赛 A Applications【模拟】
- ZOJ-3705-Applications【模拟】【10th浙江省赛】
- Struts Applications
- Applications Server
- Isolated Applications
- Debugging Applications
- WiMAX: Applications
- HKEY_CLASSES_ROOT/Applications
- Upload applications
- redis安装-单机版
- git 版本管理工具
- PowerShell命令
- 业务流量暴涨hold不住?还得靠ANS集群
- JS:求两个数组的差异,并返回差异值组成的数组
- Applications----模拟
- Redis基础数据类型详解之Hash
- 直接调用阿里云接口爬取数据
- 交换瓶子
- 关于BigDecimal 的使用
- Jquery each方法,call方法
- 设计模式六大原则(6):开闭原则
- hal库配置time需要修改库函数的地方
- 64位Linux下编译cximage动态库