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方式).那么你可以通过火狐浏 ...
随机推荐
- Android 项目Log日志输出优化
概述 Android开发过程中经常需要向控制台输出日志信息,有些人还在用Log.i(tag,msg)的形式或者system.out.println(msg)方式吗?本篇文章对日志信息输出进行优化,以达 ...
- ubuntu 通过ppa源安装mysql5.6
添加mysql5.6的源 sudo add-apt-repository -y ppa:ondrej/mysql-5.6 更新源 sudo apt-get update 安装mysql5.6 sudo ...
- 转来的——python webdriver自动化测试初步印象——转来的
python webdriver自动化测试初步印象 以下示例演示启动firefox,浏览google.com,搜索Cheese,等待搜索结果,然后打印出搜索结果页的标题 from selenium i ...
- Django DTL模板语法中的url反转
"""template_url_demo URL Configuration The `urlpatterns` list routes URLs to views. F ...
- hdu 1754 I Hate It(线段树水题)
>>点击进入原题测试<< 思路:线段树水题,可以手敲 #include<string> #include<iostream> #include<a ...
- 《Spring in action》之装配Bean
创建应用对象之间协作关系的行为通常称为装配,这也是依赖注入的本质. Spring装配Bean的三种主要机制: 1.在XML中进行显示配置 2.在java中进行显示配置 3.隐式的bean发现机制和自动 ...
- NOIP2015 提高组合集
NOIP 2015 提高组 合集 D1 T1 神奇的幻方 题目让你干啥你就干啥,让你咋走你就咋走就完事儿了 #include <iostream> #include <cstdio& ...
- 上帝说:要约炮!于是有了XMPP
一.导入XMPP框架 下载 XMPPFramework 框架 GitHub: XMPPFramework 导入依赖框架 CocoaLumberjack : 日志框架 CocoaAsyncSocket ...
- Nginx 重写规则指南
作者:运维生存时间 - 默北 链接:www.ttlsa.com/nginx/nginx-rewriting-rules-guide/ 当运维遇到要重写情况时,往往是要程序员把重写规则写好后,发给你,你 ...
- 移动端,input输入获得焦点被键盘遮住简单解决方案
(function (window,document) { document.querySelector('input[type="text"]').addEventListene ...