Applications (ZOJ 3705)
题解:就是题目有点小长而已,可能会不想读题,但是题意蛮好理解的,就是根据条件模拟,计算pts。(送给队友zm、 qsh,你们不适合训练了。)
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
int a[505]; // MaoMao Problem id
int b[505]; //Old Surgeon Contest Problem id
int prime[10000] = {0};
map<string, double>mp; // 对应于队伍相对应的奖牌再转换成分数
map<int,double>pro; // 对应题目所得分数
struct node
{
char name[500]; //名字
char xing; // 性别
char team[550]; //队名
int p; // 做的题数量
int aa[1005]; //题目的id
int c; // 参加的比赛
int bb[1005]; //比赛的rating
double pts;
} ss[600];
bool cmp(int a, int b) // 排序rating in JapanJam
{
return a > b;
}
bool cmp1(struct node a, struct node b) // 最后的得分pts排序
{
if(a.pts > b.pts)return true;
else if(a.pts == b.pts)
{
if(strcmp(a.name, b.name) <= 0)return true;
else return false;
}
return false;
}
int main()
{
int t, n,m,r,s,q,i,j,k,x,y;
prime[1] = 1; // 筛素数
for(i = 2; i <= 10000; i++)
{
if(prime[i] == 0)
{
for(j = 2; j * i <= 10000; j++)prime[i * j] = 1;
}
}
char str[500];
char op;
scanf("%d",&t);
while(t--)
{
mp.clear(); // 全部初始化
pro.clear();
memset(ss, 0, sizeof(ss));
scanf("%d%d",&n, &m);
scanf("%d", &r);
for(i = 0; i < r; i ++)
{
scanf("%d",&a[i]); // 映射
pro[a[i]] = 2.5;
}
scanf("%d", &s);
for(i = 0; i < s; i ++)
{
scanf("%d",&b[i]);
pro[b[i]] = 1.5; // 映射
}
scanf("%d",&q);
for(i = 0; i < q; i ++)
{
scanf("%s %d", str,&x);
if(x == 1)mp[str] = 36; // 映射
else if(x == 2)mp[str] = 27;
else if(x == 3)mp[str] = 18;
}
for(i = 0; i < n; i++)
{
getchar();
scanf("%s %s %c %d %d",&ss[i].name,&ss[i].team, &ss[i].xing,&ss[i].p, &ss[i].c);
for(j = 0; j < ss[i].p; j ++) // 加上做的题所得的pts分值
{
scanf("%d",&ss[i].aa[j]);
if(pro[ss[i].aa[j]] == 0 && prime[ss[i].aa[j]] == 0)ss[i].pts+=1;
else if(pro[ss[i].aa[j]] == 0)ss[i].pts +=0.3;
else ss[i].pts += pro[ss[i].aa[j]];
}
for(j = 0; j < ss[i].c; j ++)scanf("%d", &ss[i].bb[j]);
sort(ss[i].bb, ss[i].bb + ss[i].c, cmp); // 排序rating
if(ss[i].c >= 3)ss[i].pts += max((ss[i].bb[2] - 1200.0)/100.0, 0.0) * 1.5; //这里说明一点,如果前三个最大数数是一样的,那么第三个就是第三大的
ss[i].pts += mp[ss[i].team]; // 加上所在队伍拿的奖对应的pts
if(ss[i].xing == 'F')ss[i].pts += 33; // 女的额外加33
}
sort(ss, ss + n, cmp1); // 排序
for(i = 0; i < m; i++)
{
printf("%s %.3lf\n", ss[i].name, ss[i].pts);
}
}
return 0;
}
Problem
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:
Pts = max(0, (r - 1200) / 100) * 1.5
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 Mapplicants!
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 Snumbers, 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
1
5 3
3 1001 1002 1003
4 1004 1005 1006 1007
3
MagicGirl!!! 3
Sister's_noise 2
NexusHD+NexusHD 1
Edward EKaDiYaKanWen M 5 3
1001 1003 1005 1007 1009
1800 1800 1800
FScarlet MagicGirl!!! F 3 5
1004 1005 1007
1300 1400 1500 1600 1700
A NexusHD+NexusHD M 0 0
B None F 0 0
IamMM Sister's_noise M 15 1
1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015
3000
Sample Output
FScarlet 60.000
IamMM 44.300
A 36.000
Applications (ZOJ 3705)的更多相关文章
- POJ 1274 The Perfect Stall || POJ 1469 COURSES(zoj 1140)二分图匹配
两题二分图匹配的题: 1.一个农民有n头牛和m个畜栏,对于每个畜栏,每头牛有不同喜好,有的想去,有的不想,对于给定的喜好表,你需要求出最大可以满足多少头牛的需求. 2.给你学生数和课程数,以及学生上的 ...
- 2014 牡丹江现场赛 A.Average Score(zoj 3819) 解题报告
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5373 题目意思: 有两个class:A 和 B,Bob 在 Clas ...
- 2014ACM/ICPC亚洲区域赛牡丹江站现场赛-I ( ZOJ 3827 ) Information Entropy
Information Entropy Time Limit: 2 Seconds Memory Limit: 65536 KB Special Judge Information ...
- POJ 1595 Prime Cuts (ZOJ 1312) 素数打表
ZOJ:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=312 POJ:http://poj.org/problem?id=159 ...
- POJ 2590 Steps (ZOJ 1871)
http://poj.org/problem?id=2590 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1871 题目大 ...
- POJ 1065 Wooden Sticks(zoj 1025) 最长单调子序列
POJ :http://poj.org/problem?id=1065 ZOJ: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId= ...
- 2013 ACM/ICPC 长沙现场赛 A题 - Alice's Print Service (ZOJ 3726)
Alice's Print Service Time Limit: 2 Seconds Memory Limit: 65536 KB Alice is providing print ser ...
- POJ 1775 (ZOJ 2358) Sum of Factorials
Description John von Neumann, b. Dec. 28, 1903, d. Feb. 8, 1957, was a Hungarian-American mathematic ...
- Dividing a Chocolate(zoj 2705)
Dividing a Chocolate zoj 2705 递推,找规律的题目: 具体思路见:http://blog.csdn.net/u010770930/article/details/97693 ...
随机推荐
- delete删除数据造成归档日志增加,操作系统空间不足导致数据库hang住
业务需求,对日志表历史数据进行清理.历史表均很大,使用delete 操作删除90天前的数据. 第一部分:快速删除数据 SQL> alter table CC.F_LOG parallel ; S ...
- JVM学习笔记——字节码指令
JVM学习笔记——字节码指令 字节码 0与 1是计算机仅能识别的信号,经过0和1的不同组合产生了数字之上的操作.另外,通过不同的组合亦产生了各种字符.同样,可以通过不同的组合产生不同的机器指令.在不同 ...
- 基于【 MySql 】一 || 主从复制
一.centos7安装mysql 1. 先检查系统是否装有mysql rpm -qa | grep mysql 2. 下载mysql的repo源 wget http://repo.mysql.com/ ...
- g++ 生成C++ .so库文件,并调用示例
Tags: g++ C++ so library 在Linux系统下用g++命令编译C++程序.也可以生成so,a链接库 示例一 编译时链接so库 Test.h 文件内容 Main.cpp ...
- Java 面向对象(二)封装
一.封装(Encapsulation) 1.概述 封装是面向对象编程的核心思想.把对象的属性和行为封装起来,其载体就是类. 面向对象编程语言是对客观世界的模拟,客观世界里成员变量都是隐藏在对象内部的, ...
- K2 BPM_K2受邀出席QAD 2019年亚太区用户大会_全业务流程管理专家
6月12-13日,K2受邀参加了以“云聚创新,智造未来”为主题的QAD 2019年亚太区用户大会.会议上K2同与会嘉宾们共商制造业数字化转型,就如何用流程赋能企业实现智能制造进行了精彩分享. 近期发布 ...
- Oracle 11G 数据库迁移【expdp/impdp】
转自:http://www.th7.cn/db/Oracle/201802/263773.shtml 0x01 环境 A 机器,操作系统 CentOS7.3,Oracle版本:11G,IP地址:192 ...
- SAP WebIDE里UI5应用的隐藏文件project.json
在SAP WebIDE UI5应用编辑器里的菜单View->Show Hidden files点击后,即可发现项目文件夹下有一个隐藏文件project.json: 内容如下: 这也解释了为什么b ...
- 使用Linux的tcpdump命令结合Windows的wireshark抓包和分析
tcpdump简介 tcpdump是Linux系统下的一款抓包命令集,工作原理是基于网卡抓取流动在网卡上的数据包.在Linux系统中由于tcpdump命令的简单和强大,我们一般直接使用tcpdump命 ...
- 安装Vue脚手架和创建一个简单的Demo
https://www.cnblogs.com/pengjunhao/p/6762141.html https://www.cnblogs.com/yanxulan/p/8978732.html 查看 ...