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,用于在两个应用程序之间,或分布式系统中发送 ...
随机推荐
- Android textview 设置不同的字体大小和颜色
在实际应用中,需要将一个字符串已不同的颜色,字体显示出来.当然完全可以通过不同textview拼接出来.也可以通过一个textview来展示. 步骤如下: 1.定义不同style . 不妨如下定义2个 ...
- Windows下载安装jmeter
一.下载 jmeter下载地址: http://jmeter.apache.org/download_jmeter.cgi Binaries-apache-jmeter-3.0.zip 二.安装 1. ...
- CSS3 旋转3D立方体
<meta charset="utf-8"> <style> *{ margin:0px; padding:0px; } @-webkit-keyframe ...
- 官网下载旧版本的Xcode
1.登录“苹果开发者中心”——>“SDKs” 2.点击“Xcode” 3.点击页面顶部的“Download” 4.点击页面左下方的“additional tools”,这样就可以查询到各个Xco ...
- 对Spring from中日期显示格式化问题
开始时间 结束时间 保存 取消 想在input中让日期格式显示为HH:ss 但是各种百度没有找到答案 最后Google之 http://stackoverflow.com/questions/1173 ...
- shell检测interface是否已分配ip,qt调用shell脚本
#include <QCoreApplication>#include <QDebug>#include <QTextStream>#include <QDi ...
- firebreath注册接口
对firebreath文档进行翻译,顺便做个笔记,原地址:http://www.firebreath.org/display/documentation/JSAPIAuto 综述: 你可能会对需要转换 ...
- Oracle学习之常见问题处理
转自:http://blog.csdn.net/liusong0605/article/details/16349121 安装完oracle并启动服务后,通过sqlPlus无法登录,出现如下错误: s ...
- 一、富有表现力的JavaScript
第一章:富有表现力的JavaScript 1.1 JavaScript的灵活性 1.2 弱类型语言 1.3 函数是一等对象 1.4 对象的易变性 1.5 继承 1.6 JavaScript ...
- JSTL入门
在页面最上方引入 -------------------- if语句 8}"> b的值大于8 --------------------- foreach语句 i的值是:${i}