ZOJ 3705 Applications 模拟
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<sstream>
#include<cmath>
#include<climits>
#include<string>
#include<map>
#include<queue>
#include<vector>
#include<stack>
#include<set>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define pb(a) push(a)
#define INF 0x1f1f1f1f
#define lson idx<<1,l,mid
#define rson idx<<1|1,mid+1,r
#define PI 3.1415926535898
template<class T> T min(const T& a,const T& b,const T& c) {
return min(min(a,b),min(a,c));
}
template<class T> T max(const T& a,const T& b,const T& c) {
return max(max(a,b),max(a,c));
}
void debug() {
#ifdef ONLINE_JUDGE
#else freopen("in.txt","r",stdin);
freopen("d:\\out1.txt","w",stdout);
#endif
}
int getch() {
int ch;
while((ch=getchar())!=EOF) {
if(ch!=' '&&ch!='\n')return ch;
}
return EOF;
} const int maxn=;
const double eps=1e-;
int isprime(int n)
{
if(n==||n==)return ;
if(n==)return ;
for(int i=;i*i<=n;i++)
if(n%i==)return false;
return true;
}
struct APP
{
char name[];
char belong[];
char sex;
vector<int> solved;
vector<int> rating;
double score;
bool operator < (const APP &ant ) const
{
if(fabs(score-ant.score)>eps) return score>ant.score;
else return strcmp(name,ant.name)<?:;
}
}da[maxn];
map<string,int> prize;
int prob[];
int n,m; void cal()
{
for(int i=;i<=n;i++)
{
da[i].score=;
for(int j=;j<da[i].solved.size();j++)
{
int id=da[i].solved[j];
if(prob[id]==) da[i].score+=2.5;
else if(prob[id]==) da[i].score+=1.5;
else if(isprime(id)) da[i].score+=;
else da[i].score+=0.3;
}
int x=prize[string(da[i].belong)];
if(x!=&&x<=) da[i].score+= (-x)*; int rat;
if(da[i].rating.size()>=)
rat=max(,da[i].rating[]);
else rat=; da[i].score+= (rat-)/100.0*1.5; if(da[i].sex=='F') da[i].score += ;
}
sort(da+,da+n+);
}
int main()
{
int t;
scanf("%d",&t);
for(int ca=;ca<=t;ca++)
{
scanf("%d%d",&n,&m);
memset(prob,,sizeof(prob));
for(int i=;i<=;i++)
{
int x; scanf("%d",&x);
for(int j=;j<=x;j++)
{
int a; scanf("%d",&a);
prob[a]=i;
}
}
int teamnum;
scanf("%d",&teamnum);
prize.clear();
for(int i=;i<=teamnum;i++)
{
char s[];
int x;
scanf("%s%d",s,&x);
prize[string(s)]=x;
} for(int i=;i<=n;i++)
{
da[i].solved.clear();
da[i].rating.clear();
scanf("%s%s",da[i].name,da[i].belong);
da[i].sex=getch();
int a,b; scanf("%d%d",&a,&b);
for(int j=;j<=a;j++)
{
int id; scanf("%d",&id);
da[i].solved.push_back(id);
}
for(int j=;j<=b;j++)
{
int rat; scanf("%d",&rat);
da[i].rating.push_back(rat);
}
sort(da[i].rating.begin(),da[i].rating.end(),greater<int>());
}
cal(); for(int i=;i<=m;i++)
{
printf("%s %.3lf\n",da[i].name,da[i].score);
}
}
return ;
}
ZOJ 3705 Applications 模拟的更多相关文章
- ZOJ - 3705 Applications 【模拟】
题目链接 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3705 题意 给出N个队员 然后一个教练要从中选择 M名队员 要选 ...
- ZOJ 3705 Applications
点我看题目 题意 : 真是一道又臭又长的模拟题啊,不过比赛的时候没看,赛完了补的. 给你N个候选人,让你从中选M个候选人,根据四个大规则来确定每个人的分数,然后选分数前M个人的输出. 1.在MOJ上做 ...
- Applications (ZOJ 3705)
题解:就是题目有点小长而已,可能会不想读题,但是题意蛮好理解的,就是根据条件模拟,计算pts.(送给队友zm. qsh,你们不适合训练了.) #include <iostream> #in ...
- A - Jugs ZOJ - 1005 (模拟)
题目链接:https://cn.vjudge.net/contest/281037#problem/A 题目大意:给你a,b,n.a代表第一个杯子的容量,b代表第二个杯子的容量,然后一共有6种操作.让 ...
- ZOJ 2610 Puzzle 模拟
大模拟:枚举6个方向.检查每一个0是否能移动 Puzzle Time Limit: 2 Seconds Memory Limit: 65536 KB Little Georgie likes ...
- Applications(模拟)
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3705 题意:主要是分值计算要注意以下几点: (1) 在MOJ上解出的题,如 ...
- Capture the Flag ZOJ - 3879(模拟题)
In computer security, Capture the Flag (CTF) is a computer security competition. CTF contests are us ...
- ZOJ 3652 Maze 模拟,bfs,读题 难度:2
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4842 要注意题目中两点: 1.在踏入妖怪控制的区域那一刹那,先减行动力,然后才 ...
- [ZOJ 1009] Enigma (模拟)
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1009 题目大意:给你三个转换轮,只有当第一个转换轮转动一圈后第二 ...
随机推荐
- nodejs+express+jade配置
安装步骤 一.首先可跟着这个网址安装http://jingyan.baidu.com/article/91f5db1b2bb6941c7f05e33c.html,路径可由自己定. 二.同时参考http ...
- spring 事务问题
今天碰到一个奇怪的问题,在service中执行方法,调用了两次dao,前面是save,在save后面抛错,竟然没回滚,难道不是一个事务? 后来网上查资料,发现spring的事务回滚必须是运行时异常Ru ...
- 利用npoi导出Excel
npoi库是当下最流行的处理Excel.Word.PPT等Office文件格式 npoi的下载地址:http://npoi.codeplex.com/ npoi的官方学习地址: http://www. ...
- 装饰模式(Decorator pattern)
装饰模式(Decorator pattern): 又名包装模式(Wrapper pattern), 它以对客户端透明的方式扩展对象的功能,是继承关系的一个替代方案. 装饰模式以对客户透明的方式动态的给 ...
- Centos下安装Redis
转自:http://nnzhp.cn/article/9/ 遇到问题,安装后并启动,redis-cli报错:Could not connect to Redis at 127.0.0.1:6379: ...
- Activity has leaked window that was originally added
错误: E/WindowManager: android.view.WindowLeaked: Activity com.x.x.x has leaked window com.android.int ...
- php生成json或者xml数据
, ,'数据返回成功',$arr);echo $xml;?>
- VFP调用SOAPTOOLKIT 低级API
Connector=CREATEOBJECT("mssoap.HttpConnector")Connector.Property["EndPointURL"] ...
- 大毕设-MATLAB-常用知识回顾
要用到FIR滤波器和抽样器下面研究这两个的Matlab实现: Fir滤波器: matlab上fir滤波器的关键字是fir1 在command窗口输入help fir1出现帮助文档: >> ...
- Android菜鸟成长记10 -- ListVew
ListView在我们学习Android的过程中是非常重要得一个部分. listview主要有两个职责 1)将数据填充到布局. 2)处理用户的选择点击等操作. 一个ListView的创建需要3个元素 ...