SDOI(队列)
SDOI
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 841 Accepted Submission(s): 332
According to the tradition and regulation.There were two rounds of the SDOI, they are so called "Round 1" and "Round 2", the full marks of each round is 300.
All the n people take part in Round1 and Round2, now the original mark of every person is known. The rule of SDOI of ranking gets to the "standard mark". For each round there is a highest original mark,let's assume that is x.(it is promised that not all person in one round is 0,in another way,x>0). So for this round,everyone's final mark equals to his/her original mark∗(300/x).
After we got everyone's final mark in both round.We calculate the Ultimate mark of everyone as 0.3∗round1′s final mark + 0.7∗round2′s final mark.It is so great that there were no two persons who have the same Ultimate mark.
After we got everyone's Ultimate mark.We choose the persons as followed:
To encourage girls to take part in the Olympic of Information.In each province,there has to be a girl in its teams.
1. If there is no girls take part in SDOI,The boys with the rank of first m enter the team. 2. If there is girls, then the girl who had the highest score(compared with other girls) enter the team,and other(boys and other girls) m-1 people with the highest mark enter the team.
Just now all the examination had been finished.Please write a program, according to the input information of every people(Name, Sex ,The original mark of Round1 and Round2),Output the List of who can enter the team with their Ultimate mark decreasing.
For each testcase, there are two integers n and m in the first line(n≥m), standing for the number of people take part in SDOI and the allowance of the team.Followed with n lines,each line is an information of a person. Name(A string with length less than 20,only contain numbers and English letters),Sex(male or female),the Original mark of Round1 and Round2 (both equal to or less than 300) separated with a space.
Followed m lines,every line is the name of the team with their Ultimate mark decreasing.
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
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.
#include<stdio.h>
#include<string.h>
#include<algorithm>
#define MAX(x,y)(x>y?x:y)
using namespace std;
struct Node{
char name[];
int sex,r1,r2;
double r;
friend bool operator < (Node a,Node b){
if(a.r>b.r)return ;
else return ;
}
};
Node dt[];
int n,m;
void print_ans(){
sort(dt,dt+m);
for(int i=;i<m;i++){
puts(dt[i].name);
}
}
int main(){
int T;
scanf("%d",&T);
while(T--){
char s[];
scanf("%d%d",&n,&m);
int max1,max2;
max1=max2=;
for(int i=;i<n;i++){
scanf("%s%s%d%d",dt[i].name,s,&dt[i].r1,&dt[i].r2);
dt[i].sex=strcmp(s,"female")==;
max1=MAX(max1,dt[i].r1);max2=MAX(max2,dt[i].r2);
}
int i,x=-;
for(i=;i<n;i++){
dt[i].r=0.3*dt[i].r1*/max1+0.7*dt[i].r2*/max2;
}
sort(dt,dt+n);
for(i=;i<n;i++){
if(dt[i].sex){
x=i;
break;
}
}
puts("The member list of Shandong team is as follows:");
if(x==-)print_ans();
else if(x>m-){
swap(dt[m-],dt[x]);
print_ans();
}
else print_ans();
}
return ;
}
SDOI(队列)的更多相关文章
- SDOI 2019 Round1 游记
\(SDOI~2019 ~ Round1\) 游记 \(Day ~0\) 报道.骑车子去的,好热.到了之后看到好几个同校神仙,还从那里莫名其妙的等了一会,然后交了钱签了名就拿挂牌走人了.现在居然还有受 ...
- 消息队列——RabbitMQ学习笔记
消息队列--RabbitMQ学习笔记 1. 写在前面 昨天简单学习了一个消息队列项目--RabbitMQ,今天趁热打铁,将学到的东西记录下来. 学习的资料主要是官网给出的6个基本的消息发送/接收模型, ...
- 消息队列 Kafka 的基本知识及 .NET Core 客户端
前言 最新项目中要用到消息队列来做消息的传输,之所以选着 Kafka 是因为要配合其他 java 项目中,所以就对 Kafka 了解了一下,也算是做个笔记吧. 本篇不谈论 Kafka 和其他的一些消息 ...
- Beanstalkd一个高性能分布式内存队列系统
高性能离不开异步,异步离不开队列,内部是Producer-Consumer模型的原理. 设计中的核心概念: job:一个需要异步处理的任务,是beanstalkd中得基本单元,需要放在一个tube中: ...
- .net 分布式架构之业务消息队列
开源QQ群: .net 开源基础服务 238543768 开源地址: http://git.oschina.net/chejiangyi/Dyd.BusinessMQ ## 业务消息队列 ##业务消 ...
- 【原创经验分享】WCF之消息队列
最近都在鼓捣这个WCF,因为看到说WCF比WebService功能要强大许多,另外也看了一些公司的招聘信息,貌似一些中.高级的程序员招聘,都有提及到WCF这一块,所以,自己也关心关心一下,虽然目前工作 ...
- 缓存、队列(Memcached、redis、RabbitMQ)
本章内容: Memcached 简介.安装.使用 Python 操作 Memcached 天生支持集群 redis 简介.安装.使用.实例 Python 操作 Redis String.Hash.Li ...
- Java消息队列--ActiveMq 实战
1.下载安装ActiveMQ ActiveMQ官网下载地址:http://activemq.apache.org/download.html ActiveMQ 提供了Windows 和Linux.Un ...
- Java消息队列--JMS概述
1.什么是JMS JMS即Java消息服务(Java Message Service)应用程序接口,是一个Java平台中关于面向消息中间件(MOM)的API,用于在两个应用程序之间,或分布式系统中发送 ...
随机推荐
- ScrollView属性fillViewport解决android布局不能撑满全屏的问题
转:http://blog.sina.com.cn/s/blog_6cf2ea6a0102v61f.html 开发项目中遇到一个问题,布局高度在某些国产酷派小屏幕手机上高度不够全部显示,于是使用了Sc ...
- python之字符串格式化(format)
用法: 它通过{}和:来代替传统%方式 1.使用位置参数 要点:从以下例子可以看出位置参数不受顺序约束,且可以为{},只要format里有相对应的参数值即可,参数索引从0开,传入位置参数列表可用*列表 ...
- Linux 内核无线子系统
Linux 内核无线子系统 浅谈 Linux 内核无线子系统 Table of Contents 1. 全局概览 2. 模块间接口 3. 数据路径与管理路径 4. 数据包是如何被发送? 5. 谈谈管理 ...
- OSG中的几何体
osg::Shape类 继承自osg::Object类: osg::Shape类是各种内嵌几何体的基类,不但可以用于剔除和碰撞检测,还可用于生成预定义的几何体对象: 常见的内嵌几何体包括: osg:: ...
- Xamarin.Android 如何使用Assets目录下的文件
原文:Xamarin.Android 如何使用Assets目录下的文件 个人原创,转载注明出处:http://blog.csdn.net/supluo/article/details/43672411 ...
- Strange Towers of Hanoi
题目链接:http://sfxb.openjudge.cn/dongtaiguihua/E/ 题目描述:4个柱子的汉诺塔,求盘子个数n从1到12时,从A移到D所需的最大次数.限制条件和三个柱子的汉诺塔 ...
- mysql字符集编码乱码测试如下
创建三个表tb_latin1,tb_utf8,tb_gbk,编码分别为latin1/utf8/gbk “你好a”字符串编码如下GBK : %C4%E3 %BA%C3 %61UTF-8 : %E4%BD ...
- 许士彦:创业不走寻常路 APP最好时间已过
从用户体验服务设计公司eico design到拥有两千多万用户的独立微博客户端Weico,再到备受欢迎的影像APP(微可拍,Weico Gif),Weico团队走过了一条不寻常的创业之路. 作为一家新 ...
- 在Prefetcher中取消robots.txt的限制
Robots.txt是一种专门用于搜索引擎网络爬虫的文件,当构造一个网站时,如果作者希望该网站的内容被搜索引擎收录,就可以在网站中创建一个纯文本文件robots.txt,在这个文件中,声明该网站不想被 ...
- jQuery获取Select选择的Text(非表单元素)和 Value(表单元素)(转)
jQuery获取Select选择的Text和Value: 语法解释: . $("#select_id").change(function(){//code...}); //为Sel ...