HDUoj 5499 SDOI (贪心
来源:互联网 发布:python发展趋势怎么样 编辑:程序博客网 时间:2024/06/05 02:29
SDOI
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1105 Accepted Submission(s): 440
Problem Description
The Annual National Olympic of Information(NOI) will be held.The province of Shandong hold a Select(which we call SDOI for short) to choose some people to go to the NOI. n(n≤100) lines,every line is the name of the team with their Ultimate mark decreasing.
Sample Input
2
10 8
dxy male 230 225
davidwang male 218 235
evensgn male 150 175
tpkuangmo female 34 21
guncuye male 5 15
faebdc male 245 250
lavender female 220 216
qmqmqm male 250 245
davidlee male 240 160
dxymeizi female 205 190
2 1
dxy male 300 300
dxymeizi female 0 0
Sample Output
The member list of Shandong team is as follows:
faebdc
qmqmqm
davidwang
dxy
lavender
dxymeizi
davidlee
evensgn
The member list of Shandong team is as follows:
dxymeizi
Hint
For the first testcase: the highest mark of Round1 if 250,so every one’s mark times(300/250)=1.2, it’s same to Round2.
The Final of The Ultimate score is as followed
faebdc 298.20
qmqmqm 295.80
davidwang 275.88
dxy 271.80
lavender 260.64
dxymeizi 233.40
davidlee 220.80
evensgn 201.00
tpkuangmo 29.88
guncuye 14.40
For the second testcase,There is a girl and the girl with the highest mark dxymeizi enter the team, dxy who with the highest mark,poorly,can not enter the team.
Source
BestCoder Round #59 (div.2)
题很水注意下 <男女选手的关系就好
#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;struct ST{ char name[25]; char sex[15]; double r,r1,r2;}p[1000];int cmp(ST x,ST y){ return x.r > y.r;}int main(){ int T; scanf("%d",&T); while(T--){ int n, m, flag = 0, k = 0; double max_r1 = 0, max_r2 = 0; scanf("%d%d",&n,&m); for(int i = 0;i < n; i++){ scanf("%s %s %lf%lf",p[i].name,p[i].sex,&p[i].r1,&p[i].r2); max_r1 = max(max_r1,p[i].r1); max_r2 = max(max_r2,p[i].r2); if(p[i].sex[0] == 'f'){ flag = 1; } } for(int i = 0;i < n; i++){ p[i].r = 300/max_r1*p[i].r1*0.3 + 300/max_r2*p[i].r2*0.7; } sort(p,p+n,cmp); puts("The member list of Shandong team is as follows:"); if(!flag) for(int i = 0;i < m; i++) printf("%s\n",p[i].name); else{ k = 1; for(int i = 0;i < m-1; i++){ printf("%s\n",p[i].name); if(k&&p[i].sex[0] == 'f') k = 0; } if(k){ for(int i = m-1;i < n; i++){ if(p[i].sex[0] == 'f'){ printf("%s\n",p[i].name); break; } } } else printf("%s\n",p[m-1].name); } }return 0;}
0 0
- HDUoj 5499 SDOI (贪心
- HDU 1257SDOI(贪心)
- 5499 SDOI
- HDUOJ 1789(贪心)
- HDUOJ-1009 FatMouse' Trade(贪心)
- HDUoj 1070 Milk(简单贪心
- hduoj-5969【位运算】【贪心】
- HDU 5499 SDOI
- HDU 5499 SDOI
- hdoj 5499 SDOI 【拼手速】
- hdu 5499 SDOI(水)
- HDOJ 5499 SDOI (乱搞)
- 杭电5499 SDOI
- HDOJ 5499 SDOI
- HDU 5499:SDOI【排序】
- hdoj 5499 SDOI
- 【杭电】[5499]SDOI
- HDU 5499 SDOI
- 【Java】创建StringBuffer()类--可变字符串
- memcopy和memmove的区别(笔试,面试)
- 37-1-excersice
- 正则表达式匹配(re.match)
- python入门之简单socket
- HDUoj 5499 SDOI (贪心
- 启动opensips
- scanf 函数的 用法 以及陷阱
- FPM 在ubuntu下安装
- PHP调试开发环境配置
- 设计模式—工厂模式
- 积极应对认真调查Note7燃损原因 彰显企业担当
- JAVA内存模型(转载)
- Hadoop源码解析之java动态代理机制