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=505;
const double eps=1e-8;
int isprime(int n)
{
if(n==1||n==0)return 0;
if(n==2)return 1;
for(int i=2;i*i<=n;i++)
if(n%i==0)return false;
return true;
}
struct APP
{
char name[50];
char belong[50];
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)<0?1:0;
}
}da[maxn];
map<string,int> prize;
int prob[10005];
int n,m;

void cal()
{
for(int i=1;i<=n;i++)
{
da[i].score=0;
for(int j=0;j<da[i].solved.size();j++)
{
int id=da[i].solved[j];
if(prob[id]==1) da[i].score+=2.5;
else if(prob[id]==2) da[i].score+=1.5;
else if(isprime(id)) da[i].score+=1;
else da[i].score+=0.3;
}
int x=prize[string(da[i].belong)];
if(x!=0&&x<=3) da[i].score+= (5-x)*9;

int rat;
if(da[i].rating.size()>=3)
rat=max(1200,da[i].rating[2]);
else rat=1200;

da[i].score+= (rat-1200)/100.0*1.5;

if(da[i].sex==‘F‘) da[i].score += 33;
}
sort(da+1,da+n+1);
}
int main()
{
int t;
scanf("%d",&t);
for(int ca=1;ca<=t;ca++)
{
scanf("%d%d",&n,&m);
memset(prob,0,sizeof(prob));
for(int i=1;i<=2;i++)
{
int x; scanf("%d",&x);
for(int j=1;j<=x;j++)
{
int a; scanf("%d",&a);
prob[a]=i;
}
}
int teamnum;
scanf("%d",&teamnum);
prize.clear();
for(int i=1;i<=teamnum;i++)
{
char s[50];
int x;
scanf("%s%d",s,&x);
prize[string(s)]=x;
}

for(int i=1;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=1;j<=a;j++)
{
int id; scanf("%d",&id);
da[i].solved.push_back(id);
}
for(int j=1;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=1;i<=m;i++)
{
printf("%s %.3lf\n",da[i].name,da[i].score);
}
}
return 0;
}

ZOJ 3705 Applications 模拟

时间: 2024-10-05 23:09:26

ZOJ 3705 Applications 模拟的相关文章

ZOJ 3705 Applications

Applications Time Limit: 2 Seconds      Memory Limit: 65536 KB 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 univ

ZOJ 2610 Puzzle 模拟

大模拟:枚举6个方向,检查每个0能否移动 Puzzle Time Limit: 2 Seconds      Memory Limit: 65536 KB Little Georgie likes puzzles very much. Recently he has found a wooden triangle in the box with old toys. The side of the triangle is n inches long. The triangle is divided

A - Jugs ZOJ - 1005 (模拟)

题目链接:https://cn.vjudge.net/contest/281037#problem/A 题目大意:给你a,b,n.a代表第一个杯子的容量,b代表第二个杯子的容量,然后一共有6种操作.让你用尽可能少的步骤将第二个杯子的当前的水的体积转换成n. 具体思路:就是队列模拟啊,,,,打比赛的时候脑子瓦特了,没读完题目就开始读了,,,这个毛病确实得改了,, AC代码: 1 #include<iostream> 2 #include<stack> 3 #include<io

[ZOJ 1009] Enigma (模拟)

题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1009 题目大意:给你三个转换轮,只有当第一个转换轮转动一圈后第二个才会转,当第二个转动一圈后第三个才会转.转换轮的意思是我按动一个按钮,显示器经过转换轮的转换显示另外一个字母.每按下一个按钮,第一个转换轮都会转动一次. 叉姐说得好,多学习一下思维方法,有些问题都是能够很高效率的想出来的.脑洞什么的全是骗人的. 注意看这张图: 中间转动轮的点, 左右两边是一一对应

ZOJ 3652 Maze 模拟,bfs,读题 难度:2

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4842 要注意题目中两点: 1.在踏入妖怪控制的区域那一刹那,先减行动力,然后才能杀妖怪 2.在妖怪控制区域行动力也会恢复 3.妖怪也许不在自己的控制区域 #include <cstdio> #include <cstring> #include <algorithm> #include <queue> using namespace st

组队赛#1 解题总结 ZOJ 3803 YY&#39;s Minions (DFS搜索+模拟)

YY's Minions Time Limit: 2 Seconds      Memory Limit: 65536 KB Despite YY's so much homework, she would like to take some time to play with her minions first. YY lines her minions up to an N*M matrix. Every minion has two statuses: awake or asleep. W

HDU 1986 &amp; ZOJ 2989 Encoding(模拟)

题目链接: HDU: http://acm.hdu.edu.cn/showproblem.php?pid=1986 ZOJ: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=1988 HDU 1987 & ZOJ 2990 和这题刚好相反,也是比较容易模拟: Chip and Dale have devised an encryption method to hide their (written) text messages

[ACM] ZOJ 3844 Easy Task (模拟+哈希)

Easy Task Time Limit: 2 Seconds      Memory Limit: 65536 KB You are given n integers. Your task is very easy. You should find the maximum integer a and the minimum integer b among these n integers. And then you should replace both a and bwith a-b. Yo

ZOJ 3804 YY&#39;s Minions (简单模拟)

1 /* 2 题意:一个矩阵中有 n*m个宠物,每一个宠物都有一个状态, 1醒着的,0睡着的 3 X离开的!如果这个宠物(醒着的)的周围醒着的个数>3 || <2它就会睡着, 4 如果这个宠物(睡着的)的周围醒着的个数==3就会醒来! 5 每一分钟都会有变换一个状态! 6 其中会有些宠物会在给定的时间内离开! 7 */ 8 #include<iostream> 9 #include<cstring> 10 #include<cstdio> 11 #inclu