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 ...
随机推荐
- JVM基础(6)-常用参数总结
参考文章: 并发编程网:http://ifeve.com/useful-jvm-flags-part-4-heap-tuning/ 一.参数分类 HotSpot JVM 提供了三类参数. 第一类包括了 ...
- Lucene基础(1)
下一篇: Lucene基础(2) 一.Lucene介绍 http://www.kailing.pub/index/columns/colid/16.html Documentation:http:// ...
- 使用GNU/Linux播放电视节目
目前,生活中很多事情都可以在电脑前完成,读书.写程序.听音乐.看视频等.如果也可以在电脑上收看有线电视节目的话,那就更好了.为此,我购买了圆刚视频采集卡AverMedia C725B.如下图所示. 官 ...
- LeetCode OJ 123. Best Time to Buy and Sell Stock III
Say you have an array for which the ith element is the price of a given stock on day i. Design an al ...
- js数据转换
javascript有如下数据类型的转换方法:一,转换成数字 xxx*1.0 转换成字符串 xxx+"" 二,从一个值中提取另一种类型的值,并完成转换工作. 1.提取字符串中的整数 ...
- 自定义函数动态执行SQL语句
Oracle 动态SQL有两种写法:用 DBMS_SQL 或 execute immediate,建议使用后者. DDL 和 DML Sql代码 收藏代码 /*** DDL ***/ begin EX ...
- AS3.0杂记——Dictionary、Object与Array
来源:http://blog.csdn.net/m_leonwang/article/details/8811829 Object.Array与Dictionary都是关联数组,就是用“键”来索引存储 ...
- JIRA搭建
请参考下面的文章 http://www.linuxidc.com/Linux/2014-09/106995.htm 所需下载的文件 链接: http://pan.baidu.com/s/1c0wad3 ...
- log4j2配置MDC分线程写日志
1.MDC是一个高级一些的工具,可以配置分用户(userid)写日志,也可以分线程 2.方法和道理都是相似的,在写入日志之前配置线程名或者用户id 3.如果将线程名配置为目录,可以将不同线程的日志输送 ...
- Struts2--课程笔记1
第一个Struts程序: 在开发Struts程序之前,首先要导入额外的jar包,基本需求的是14个jar包,关于14个ja包是什么,有什么作用,此处不讲述. 还要配置web.xml文件,注册Strut ...