Applications(模拟)
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3705
题意:主要是分值计算要注意以下几点:
(1) 在MOJ上解出的题,如果是 MaoMao Selection 则加2.5分,如果是来自 Old Surgeon Contest则加1.5分,除了这两种情况外,如果解出的题号是素数,加1分,如果都不符合上述情况则加0.3分。
(2)参加 ACM/ICPC 的队伍,一等奖加36分,二等奖加27,三等奖加18分,其余不加分。(ps:一个队伍可能参加多次比赛)。
(3)有rating值的按照得分公式:Pts = max(0, (r - 1200) / 100) * 1.5,(注意公式中的类型要转换成double),其中r代表第三高的rating值。
(4)如果是女生的话加33分。
最后的输出要求按分值高低输出前M个人的名字和分值,如果分值相同则按名字的字典序输出。
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <map>
#include <algorithm>
using namespace std;
const int N=;
int f[N],vR[N],vS[N],p[N];
void is_prime( )
{
f[] = ;
f[] = ;
for (int i = ; i < N; i ++)
{
f[i] = i%;
}
for (int i = ; i <= ; i ++)
{
if (f[i])
{
for (int j = *i; j < N; j += i)
f[j] = ;
}
}
}
struct node
{
string name;
double score;
friend bool operator < (const node a,const node b)
{
if (a.score == b.score)//分值相同时按名字排序
{
return a.name < b.name;
}
return a.score > b.score;//分值不同时从高到低排序 }
} a[];
int main()
{
int t;
scanf("%d",&t);
is_prime();//素数打表
while(t--)
{
for (int i = ; i < ; i++)
a[i].score = ;
map<string,double>Map;
memset(vR,,sizeof(vR));
memset(vS,,sizeof(vS));
int n,m,x;
int R,S;
scanf("%d%d",&n,&m);
scanf("%d",&R);
for (int i = ; i < R; i++)
{
scanf("%d",&x);
vR[x] = ;//标记第一种题
}
scanf("%d",&S);
for (int j = ; j < S; j++)
{
scanf("%d",&x);
vS[x] = ;//标记第二种题
}
int Q;
scanf("%d",&Q);
while(Q--)
{
int rank1;
string name;
cin>>name>>rank1;
if (rank1==)//根据队伍的名次加分
Map[name] += ;
else if (rank1==)
Map[name] += ;
else if (rank1==)
Map[name] += ;
else
Map[name] += ;
}
for (int i = ; i < n; i++)
{
int num1,num2;
string pname,tname,sex;
cin>>pname>>tname>>sex>>num1>>num2;
a[i].name = pname;
a[i].score+=Map[tname];
if (sex=="F")//女生加分
a[i].score+=;
for (int j = ; j < num1; j++)
{
scanf("%d",&x);
if(vR[x])//做的第一种题
a[i].score+=2.5;
else if (vS[x])//做的第二种题
a[i].score+=1.5;
else
{
if(f[x])//题号为素数
a[i].score+=1.0;
else
a[i].score+=0.3;
}
}
memset(p,,sizeof(p));
for (int j = ; j < num2; j++)
scanf("%d",&p[j]);//rating值
if (num2 >= )
{
sort(p,p+num2);//rating排序,由第三高的rating值带人公式计算分值
double temp = max(0.0,(1.0*p[num2-]-1200.0)/100.0)*1.5;
a[i].score+=temp;
}
}
sort(a,a+n);//按输出要求排序
for (int i = ; i < m; i++)
{
cout<<a[i].name;
printf(" %.3f\n",a[i].score);
}
}
return ;
}
Applications(模拟)的更多相关文章
- ZOJ 3705 Applications 模拟
#pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include< ...
- ZOJ - 3705 Applications 【模拟】
题目链接 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3705 题意 给出N个队员 然后一个教练要从中选择 M名队员 要选 ...
- 在PC上测试移动端网站和模拟手机浏览器的5大方
查了很多资料,尝试了大部分方法,下面将这一天的努力总结下分享给大家,也让大家免去看那么多文章,以下介绍的方法,都是本人亲自测试成功的方法,测试环境winxp. 一.Chrome*浏览器 chrome模 ...
- 整理分享C#通过user32.dll模拟物理按键操作的代码
对系统模拟按键方面的知识和按键映射代码做了一下梳理,在这里分享出来,适用于开发自动操作工具和游戏外挂. 主代码: public const int KEYEVENTF_EXTENDEDKEY = 0x ...
- POJ 1016 模拟字符串
Numbers That Count Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 20396 Accepted: 68 ...
- ns3模拟无线Ad hoc 网络通信
Ad hoc网络 Ad hoc网是一种多跳的.无中心的.自组织无线网络,又称为多跳网(Multi-hop Network).无基础设施网(Infrastructureless Network)或自组织 ...
- Codeforces Round #366 (Div. 2) C 模拟queue
C. Thor time limit per test 2 seconds memory limit per test 256 megabytes input standard input outpu ...
- splinter python浏览器自动化操作,模拟浏览器的行为
Splinter可以非常棒的模拟浏览器的行为,Splinter提供了丰富的API,可以获取页面的信息判断当前的行为所产生的结果 最近在研究网站自动登录的问题,涉及到需要实现浏览器自动化操作,网上有 ...
- java模拟浏览器包selenium整合了htmlunit,火狐浏览器,IE浏览器,opare浏览器驱
//如果网页源码中有些内容是js渲染过来的,那你通过HttpClient直接取肯定取不到,但是这些数据一般都是通过异步请求传过来的(一般都是通过ajax的get或者post方式).那么你可以通过火狐浏 ...
随机推荐
- thymeleaf的使用及配置
* th:action <form id="login" th:action="@{/login}">......</form> ...
- Storm 开箱笔记
目录 Storm 开箱 1. 什么是 Storm 2. Hello World(WordCountTopology) 3. 常用API 4. 基本概念 5. 流分组策略 6. 并行度 7. Acker ...
- vs2012+ winform+.net4.0发布如何在xp上运行
今天在英文版vs2013打包发布4.0(非4.0 client)的winform时,遇到了在xp上无法运行的情况,.net framework 4.0在xp上已安装.在打包前,winform工程,即菜 ...
- scrapy 按顺序抓取text内容
需求:获得如下li.clearfix 下的所有text,并且按顺序输出 1. x.css('div.reply-doc h4 a::text').extract(); 2. x.css('div.r ...
- 超星toPDF
* ssReader to pdf Note: editor: Emacs-org 1. download and open the book with sspreader 2. click ...
- PAT 1130 Infix Expression
Given a syntax tree (binary), you are supposed to output the corresponding infix expression, with pa ...
- 【Codeforces 1118D1】Coffee and Coursework (Easy version)
[链接] 我是链接,点我呀:) [题意] 题意 [题解] 从小到大枚举天数. 然后贪心地,从大到小分配a[i]到各个天当中. a[n]分配到第1天,a[n-1]分配到第2天,...然后a[n-x]又分 ...
- 【Codeforces 584D】Dima and Lisa
[链接] 我是链接,点我呀:) [题意] 让你把一个奇数n分成最多个质数的和 [题解] 10的9次方以内,任意两个质数之间的差距最大为300 因此可以这样,我们先从i=n-2开始一直递减直到i变成最大 ...
- RxJava如何结合观察者与链式处理
RxJava如何结合观察者与链式处理 Author: Dorae Date: 2018年12月3日17:10:31 转载请注明出处 一.概述 首先问自己几个问题,如果非常清楚这几个问题的目的与答案,那 ...
- Jenkins+Github持续集成
由于最近团队代码库从coding迁移到github,在CI工具的选型上尝试了travis-ci和circle-ci,最后决定自己搭建CI服务器,而我也有幸认领了这个任务的调研,因此有了这篇文章. 之前 ...