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 ...
随机推荐
- 浙大 pat 1007题解
Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, ...
- 三、WCF的宿主
注:本文为学习摘抄,原文地址:http://www.cnblogs.com/iamlilinfeng/archive/2012/10/01/2706353.html 一.WCF服务应用程序与WCF服务 ...
- OpenGL多视口
#include <gl/glew.h> #include <gl/freeglut.h> #include <iostream> ; ; float rtri = ...
- Activity的四中启动模式的应用场景。
1,standard 默认情况下的启动模式,队列排序,linked 2,singleTop ,任务栈栈顶只有一个实例.如果Activity A在栈顶,就不会在A 的上面创建新的 Activity A ...
- UPX3.03+UpolyX.5 Shell v1.0 汉化绿色版
软件名称:UPX3.03+UpolyX.5 Shell v1.0 汉化绿色版软件类别:汉化软件运行环境:Windows软件语言:简体中文授权方式:免费版软件大小:635 KB软件等级:整理时间:201 ...
- hdu 5584 gcd/lcm/数学公式
input T 1<=T<=1000 x y output 有多少个起点可以走n(n>=0)步走到(x,y),只能从(x,y)走到(x,y+lcm(x,y))/(x+lcm(x,y) ...
- photoshop cs6 mac版
首选项 -> 界面,调整工作区背景色 放大:command + "+" 放大镜:z 矩形选框工具(M):用来抠图,做造型.shift正方形选取 填充前景色:alt + del ...
- div盒布局
最近在应用程序中内嵌webkit浏览器显示网页,网页的布局是自适应的,采用盒布局模型,能够实现较好的自适应效果. <style> html,body { height: 100%; mar ...
- java的(PO,VO,TO,BO,DAO,POJO)包解释
java的(PO,VO,TO,BO,DAO,POJO)解释 action包 顾名思义请求,主要是和view 即我们所说的视图就是页面打交道,action类 是 操作方法,对于页 面Form 表单的操 ...
- .net core 系列
1..net core 验证码 2..net core 导出excel 3..net core 上传文件 4..net core 时间戳转换 5..net core 读取配置文件 6..net cor ...