HDU/5499/模拟
题目链接
模拟题,直接看代码。
£:分数的计算方法,要用double;
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
typedef pair<int, int> pa;
typedef long long LL;
const int maxn=100+100;
struct node
{
string na;
double a;
double b;
double ans;
bool operator<(const node x)const
{
return x.ans<ans;
}
};
node man [maxn];
node woman[maxn];
node t [maxn];
string x1,x2;
double t1=0.0,t2=0.0;
void init()
{
for(int i=0;i<=100+1;i++)
{
woman[i].ans=0;
man [i].ans=0;
t [i].ans=0;
}
}
int main ()
{
int T;
scanf("%d",&T);
while(T--)
{
init();
int n,m;
scanf("%d%d",&n,&m);
int k1=0,k2=0;
bool fg=0;
double xx=0.0,yy=0.0;
for(int i=0;i<n;i++)
{
cin>>x1>>x2>>t1>>t2;
if(x2[0]=='m')
{
man[k1].na=x1;
man[k1].a=t1;
man[k1].b=t2;
xx=max(xx,t1);
yy=max(yy,t2);
k1++;
}
else
{
fg=1;
woman[k2].na=x1;
woman[k2].a=t1;
woman[k2].b=t2;
xx=max(xx,t1);
yy=max(yy,t2);
k2++;
}
}
xx=(double)300.0/(double)xx;
yy=(double)300.0/(double)yy;
for(int i=0;i<k1;i++)
man[i].ans=(double)man[i].a*xx*0.3+man[i].b*yy*0.7;
for(int i=0;i<k2;i++)
woman[i].ans=(double)woman[i].a*xx*0.3+woman[i].b*yy*0.7;
sort(woman,woman+k2);
if(fg)
{
int k=0;
t[k].na=woman[0].na;
t[k].ans=woman[0].ans;
k++;
for(int i=1;i<k2;i++)
{
man[k1].na=woman[i].na;
man[k1].ans=woman[i].ans;
k1++;
}
sort(man,man+k1);
for(int i=0;i<m-1;i++)
{
t[k].na=man[i].na;
t[k].ans=man[i].ans;
k++;
}
sort(t,t+m);
cout<<"The member list of Shandong team is as follows:"<<endl;
for(int i=0;i<m;i++)
cout<<t[i].na<<endl;
}
else
{
for(int i=0;i<k2;i++)
{
man[k1].na=woman[i].na;
man[k1].ans=woman[i].ans;
k1++;
}
sort(man,man+k1);
cout<<"The member list of Shandong team is as follows:"<<endl;
for(int i=0;i<m;i++)
cout<<man[i].na<<endl;
}
}
return 0;
}
HDU/5499/模拟的更多相关文章
- hdu 4891 模拟水题
http://acm.hdu.edu.cn/showproblem.php?pid=4891 给出一个文本,问说有多少种理解方式. 1. $$中间的,(s1+1) * (s2+1) * ...*(sn ...
- hdu 5012 模拟+bfs
http://acm.hdu.edu.cn/showproblem.php?pid=5012 模拟出骰子四种反转方式,bfs,最多不会走超过6步 #include <cstdio> #in ...
- hdu 4669 模拟
思路: 主要就是模拟这些操作,用链表果断超时.改用堆栈模拟就过了 #include<map> #include<set> #include<stack> #incl ...
- 2013杭州网络赛C题HDU 4640(模拟)
The Donkey of Gui Zhou Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/O ...
- hdu 5003 模拟水题
http://acm.hdu.edu.cn/showproblem.php?pid=5003 记得排序后输出 #include <cstdio> #include <cstring& ...
- hdu 5033 模拟+单调优化
http://acm.hdu.edu.cn/showproblem.php?pid=5033 平面上有n个建筑,每个建筑由(xi,hi)表示,m组询问在某一个点能看到天空的视角范围大小. 维护一个凸包 ...
- HDU 2860 (模拟+并查集)
Regroup Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Sub ...
- hdu 5083(模拟)
Instruction Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total ...
- hdu 5055(模拟)
Bob and math problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Oth ...
随机推荐
- Docker 制作mysql镜像
# 拉取Ubuntu镜像 docker pull docker.io/ubuntu: # 运行一个容器 docker run --name mysql -p 33:3306 -v /mysql:/va ...
- 去除VisualStudio中拼写错误检测的红色波浪线
去除VisualStudio中拼写错误检测的红色波浪线 在Visual Assistant中将 Underline spelling errors in comments and strings us ...
- NOIP2005-普及组复赛-第一题-陶陶摘苹果
题目描述 Description 陶陶家的院子里有一棵苹果树,每到秋天树上就会结出10个苹果.苹果成熟的时候,陶陶就会跑去摘苹果.陶陶有个30厘米高的板凳,当她不能直接用手摘到苹果的时候,就会踩到板凳 ...
- xTiNt 论坛发帖辅助软件 1.0 绿色版
软件名称:xTiNt 论坛发帖辅助软件 1.0 绿色版软件语言: 简体中文授权方式: 免费软件应用平台: Win7 / Vista / Win2003 / WinXP / Win2008 软件大小: ...
- 简单的javasrcipt选项卡
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta char ...
- js数据转换
javascript有如下数据类型的转换方法:一,转换成数字 xxx*1.0 转换成字符串 xxx+"" 二,从一个值中提取另一种类型的值,并完成转换工作. 1.提取字符串中的整数 ...
- 一个有用的shell脚本
#!/bin/bash #if [ $1 -eq null ]; then # echo "please input params1!" # exit #fi #if [ $2 - ...
- javaWEB总结(2): load-on-startup节点
在javaWEB总结(1)里面,我们创建了一个servlet以及它的映射,当我们访问那个映射地址的时候,就可以访问servlet,并且servlet容器调用了生命周期方法,销毁前调用destroy方法 ...
- PAT (Top Level) Practise 1005 Programming Pattern (35)
后缀数组.排序之后得到height数组,然后从上到下将height>=len的都分为一组,然后找到第一组个数最多的输出即可. #pragma comment(linker, "/STA ...
- 测试TCP/IP配置
安装网络硬件和网络协议之后,我们一般要进行TCP/IP协议的测试工作,那么怎样测试才算是比较全面的测试呢?我们认为,全面的测试应包括局域网和互联网两个方面,因此应从局域网和互联网两个方面测试,以下是我 ...