ZOJ 3705 Applications
题意 : 真是一道又臭又长的模拟题啊,不过比赛的时候没看,赛完了补的。
给你N个候选人,让你从中选M个候选人,根据四个大规则来确定每个人的分数,然后选分数前M个人的输出。
1、在MOJ上做过题的根据以下规则来计算加分:
- 如果题目是MAOMAO中的,做对一道加2.5分
- 如果题目是Old Surgeon Contest中的做对一个加1.5分,当然在MAOMAO中没有与Old Surgeon Contest中相同的题
- 如果不是两个中的题,但是题号是素数的做对一道加1分
- 如果不是上边三种情况中的任何一种,做对一道加0.3分。
2、 Marjar学校每年都会举办比赛,如果申请人中有得了奖的,一等奖加36分,二等奖加27分,三等奖加18分,否则加0分。
3、还有在别的OJ上做比赛的,会根据他们做的情况进行加分,如果在那些OJ上做的比赛超过三场的,取第三高的分数进行运算,pts = max(0, (r - 1200) / 100) * 1.5,r 即第三高的分数,然后将pts加入到最后的得分中。
4、如果申请人是女生再多加上33分。
思路 :题意已经说的差不多了,接下来就可以模拟了。注意好细节就可以了。
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <string>
#include <map> using namespace std ; struct node
{
string name ;
double score ;
bool operator<(node a)const{
if(score == a.score)
return name < a.name ;
return score > a.score ;
}
}pt[] ; map<string,int>mapp ;
int Mao[] , OSC[] ,ss[]; int isprime(int n)
{
for(int i = ; i*i <= n ; i++)
if(n%i == )
return ;
return ;
}
int main()
{
int T,N,M,R,S,m,Q,n ;
scanf("%d",&T) ;
char nam[] ;
while(T--)
{
memset(Mao,,sizeof(Mao)) ;
memset(OSC,,sizeof(OSC)) ;
memset(ss,,sizeof(ss)) ;
mapp.clear() ;
scanf("%d %d",&N,&M) ;
scanf("%d",&R) ;
for(int i = ; i < R ; i++){scanf("%d",&m) ;Mao[m] = ;}
scanf("%d",&S) ;
for(int i = ; i < S ; i++){scanf("%d",&m) ; OSC[m] = ;}
scanf("%d",&Q) ;
for(int i = ; i < Q ; i++)
{
scanf("%s %d",nam,&m) ;
if(m == ) mapp[nam] += ;
else if(m == ) mapp[nam] += ;
else if(m == ) mapp[nam] += ;
else mapp[nam] += ;
}
char sex ;
for(int i = ; i < N ; i++)
{
cin >> pt[i].name>>nam>>sex>>m>>n ;
if(sex == 'M')
pt[i].score = ;
else pt[i].score = ;
pt[i].score += mapp[nam] ;
int id ;
for(int j = ; j < m ; j++)
{
scanf("%d",&id) ;
if(Mao[id]) pt[i].score += 2.5 ;
else if(OSC[id]) pt[i].score += 1.5 ;
else if(isprime(id)) pt[i].score += ;
else pt[i].score += 0.3 ;
}
for(int j = ; j < n ; j++) scanf("%d",&ss[j]) ;
if(n >= )
{
sort(ss,ss+n) ;
pt[i].score += max(0.0, (ss[n-] - ) / 100.0) * 1.5 ;
}
}
sort(pt,pt+N) ;
for(int i = ; i < M ; i++)
{
cout<<pt[i].name ;
printf(" %.3f\n",pt[i].score) ;
}
}
return ;
}
ZOJ 3705 Applications的更多相关文章
- ZOJ - 3705 Applications 【模拟】
题目链接 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3705 题意 给出N个队员 然后一个教练要从中选择 M名队员 要选 ...
- ZOJ 3705 Applications 模拟
#pragma comment(linker, "/STACK:1024000000,1024000000") #include<cstdio> #include< ...
- Applications (ZOJ 3705)
题解:就是题目有点小长而已,可能会不想读题,但是题意蛮好理解的,就是根据条件模拟,计算pts.(送给队友zm. qsh,你们不适合训练了.) #include <iostream> #in ...
- POJ 2418 ,ZOJ 1899 Hardwood Species - from lanshui_Yang
Description Hardwoods are the botanical group of trees that have broad leaves, produce a fruit or nu ...
- Detect the Virus ZOJ - 3430 AC自动机
One day, Nobita found that his computer is extremely slow. After several hours' work, he finally fou ...
- ZOJ People Counting
第十三届浙江省大学生程序设计竞赛 I 题, 一道模拟题. ZOJ 3944http://www.icpc.moe/onlinejudge/showProblem.do?problemCode=394 ...
- ZOJ 3686 A Simple Tree Problem
A Simple Tree Problem Time Limit: 3 Seconds Memory Limit: 65536 KB Given a rooted tree, each no ...
- Authorization in Cloud Applications using AD Groups
If you're a developer of a SaaS application that allows business users to create and share content – ...
- DAC Usage3:Monitor Data-tier Applications
If you deploy a DAC to a managed instance of the Database Engine, information about the deployed DAC ...
随机推荐
- ASP.NET会员注册登录模块(MD5加密,Parameters防止SQL注入,判断是否注册)
MD5加密,Parameters防止SQL注入: protected void btnLog_Click(object sender, EventArgs e) { //获取验 ...
- ASPxGridView动态创建表格列编辑模板
在项目中用到了DevExpress的ASPxGridview控件,每每去配置它的时候,总感觉很是啰嗦,于是想到了用代码自动配置. 于是有了这样的代码: foreach (ZiyuWeb.Entity. ...
- 设计模式------STRATEGY(策略模式)
http://blog.csdn.net/wuzhekai1985/article/details/6665197.仅供参考. 策略模式:实现替换功能,如cache替换算法:当发生Cache缺失时,C ...
- sql2008存储过程解密。
今天有一个同事在做一个项目的时候,因为现在公司不跟某一家公司合作.有一些sql的存储过程是加密,现在想打开那些存储过程来解密.故查看了一些资料终于解密成功.步骤如下: 1.需要开始DAC连接. 1.1 ...
- zookeeper实现互斥锁
简单的说,zookeeper就是为了解决集群环境中数据一致性的问题. 举个很简单栗子: 有一个变量A,分别存在于两台服务器中,某个程序需要用到变量A,就随机地访问其中一台服务器并取得变量A的值,对吧? ...
- 第十三篇、jQuery Mobile
API-->搜索data 0.page data-transition="slide" // 页面切换效果 data-position="fixed" / ...
- OC1_汉字拼音转换 练习
// // WordManager.h // OC1_汉字拼音转换 // // Created by zhangxueming on 15/4/27. // Copyright (c) 2015年 z ...
- php封装文件上传
这是一个经常在项目中遇到的问题,所以封装一个,分享给大家. 一,前期配置php.ini 如果上传文件超过了php配置那么$_POST或者$_FILES等都是空数组,这点是一个坑,因为那时候就不 ...
- Codevs 1684 垃圾陷阱
1684 垃圾陷阱 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 黄金 Gold 题目描述 Description 卡门--农夫约翰极其珍视的一条Holsteins奶牛--已经落了 ...
- 洛谷 P1108 低价购买
P1108 低价购买 标签 动态规划 难度 提高+/省选- 题目描述 "低价购买"这条建议是在奶牛股票市场取得成功的一半规则.要想被认为是伟大的投资者,你必须遵循以下的问题建议:& ...