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 ...
随机推荐
- 1、Spring概述
Java EE优缺点 我们都知道在2003年Spring兴起之前,企业普遍使用J2EE技术来开发企业级应用,为什么用J2EE呢?主要原因有以下几个: 1.Java本身的跨平台能力,可移植性强2.J2E ...
- infix expression 计算完全版
#include<iostream> #include<stack> #include<string> using namespace std; char comp ...
- 转Delphi中Memo显示行号列号
http://www.alonely.com.cn/Delphi/20160814/8912.html 实例说明本例是个光标应用的简单技巧,希望通过这个例子的学习后能举一反三.Delphi中像这样简单 ...
- 一步一步学EF系列3【升级篇 实体与数据库的映射】
之前的三张为基础篇,如果不考虑架构问题,做一般的小程序,以足够用了.基本的增删改查也都有了.但是作为学习显然是不够的.通过之前三章的学习,有没有发现这样写有什么问题,有没有觉得繁琐的?可能有人会说,之 ...
- 一步一步学EF系列1【Fluent API的方式来处理实体与数据表之间的映射关系】
EF里面的默认配置有两个方法,一个是用Data Annotations(在命名空间System.ComponentModel.DataAnnotations;),直接作用于类的属性上面,还有一个就是F ...
- jQuery 事件 - bind() 方法
定义和用法 bind() 方法为被选元素添加一个或多个事件处理程序,并规定事件发生时运行的函数. 实例1(一个事件) 记得把js引用地址换掉 当点击鼠标时,隐藏或显示 p 元素: <html&g ...
- 星语硬件检测专家 V4.3 官方版
软件名称: 星语硬件检测专家 软件语言: 简体中文 授权方式: 免费软件 运行环境: Win 32位/64位 软件大小: 15.8MB 图片预览: 软件简介: 星语硬件检测专家是一款功能非常强大的硬件 ...
- javascript焦点图自动缓冲滚动
html中调用的js库,之前的随笔中有写,就不细说了,不明白的可以留言给我 <!DOCTYPE html> <html> <head> <meta chars ...
- 从MySQL全库备份中恢复某个库和某张表【转】
从MySQL全库备份中恢复某个库和某张表 一.全库备份-A [root@mha2 backup]#mysqldump -uroot -p123456 --default-character-set=u ...
- 使用node.js创建第一个应用
node.js应用组成部分 1.引入require模块:我们可以使用require指令来载入Node.js模块. 2.创建服务器:服务器可以监听客户端的请求,类似于Apache,Nninx等HTTP服 ...