SDOI

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 841    Accepted Submission(s): 332

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) people comes to the Select and there is m(m≤50) people who can go to the NOI.
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.
 
Input
There is an integer T(T≤100) in the first line for the number of testcases and followed T testcases.
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.
 
Output
For each testcase, output "The member list of Shandong team is as follows:" without Quotation marks.
Followed m 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.

 
题解:第一次打bc,弱爆了,水了一题,还各种错。。。。这道题没注意还要找最值300/x,错了半天;最终还是错了。。。。。。。
ac代码:
 #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(队列)的更多相关文章

  1. SDOI 2019 Round1 游记

    \(SDOI~2019 ~ Round1\) 游记 \(Day ~0\) 报道.骑车子去的,好热.到了之后看到好几个同校神仙,还从那里莫名其妙的等了一会,然后交了钱签了名就拿挂牌走人了.现在居然还有受 ...

  2. 消息队列——RabbitMQ学习笔记

    消息队列--RabbitMQ学习笔记 1. 写在前面 昨天简单学习了一个消息队列项目--RabbitMQ,今天趁热打铁,将学到的东西记录下来. 学习的资料主要是官网给出的6个基本的消息发送/接收模型, ...

  3. 消息队列 Kafka 的基本知识及 .NET Core 客户端

    前言 最新项目中要用到消息队列来做消息的传输,之所以选着 Kafka 是因为要配合其他 java 项目中,所以就对 Kafka 了解了一下,也算是做个笔记吧. 本篇不谈论 Kafka 和其他的一些消息 ...

  4. Beanstalkd一个高性能分布式内存队列系统

    高性能离不开异步,异步离不开队列,内部是Producer-Consumer模型的原理. 设计中的核心概念: job:一个需要异步处理的任务,是beanstalkd中得基本单元,需要放在一个tube中: ...

  5. .net 分布式架构之业务消息队列

    开源QQ群: .net 开源基础服务  238543768 开源地址: http://git.oschina.net/chejiangyi/Dyd.BusinessMQ ## 业务消息队列 ##业务消 ...

  6. 【原创经验分享】WCF之消息队列

    最近都在鼓捣这个WCF,因为看到说WCF比WebService功能要强大许多,另外也看了一些公司的招聘信息,貌似一些中.高级的程序员招聘,都有提及到WCF这一块,所以,自己也关心关心一下,虽然目前工作 ...

  7. 缓存、队列(Memcached、redis、RabbitMQ)

    本章内容: Memcached 简介.安装.使用 Python 操作 Memcached 天生支持集群 redis 简介.安装.使用.实例 Python 操作 Redis String.Hash.Li ...

  8. Java消息队列--ActiveMq 实战

    1.下载安装ActiveMQ ActiveMQ官网下载地址:http://activemq.apache.org/download.html ActiveMQ 提供了Windows 和Linux.Un ...

  9. Java消息队列--JMS概述

    1.什么是JMS JMS即Java消息服务(Java Message Service)应用程序接口,是一个Java平台中关于面向消息中间件(MOM)的API,用于在两个应用程序之间,或分布式系统中发送 ...

随机推荐

  1. hadoop笔记之MapReduce的应用案例(WordCount单词计数)

    MapReduce的应用案例(WordCount单词计数) MapReduce的应用案例(WordCount单词计数) 1. WordCount单词计数 作用: 计算文件中出现每个单词的频数 输入结果 ...

  2. C#学习日志 day8 -------------- async await 异步方法入门(引用博客)以及序列化和反序列化的XML及json实现

    首先是异步方法的介绍,这里引用自http://www.cnblogs.com/LoveJenny/archive/2011/11/01/2230933.html async and await 简单的 ...

  3. SQL Server 查看数据页面

    第一步: 找到表的第一页dbcc ind(db_name,table_name,-1); 例子. dbcc ind(studio,person,-1);# pageFID  是文件号   pagePI ...

  4. php各类hash算法长度及性能

    Hash结果如下 <?php $data = "hello world"; foreach (hash_algos() as $v) { $r = hash($v, $dat ...

  5. LNMP : 502 Bad Gateway 解决小记,真正的原因

    站点搬迁到新的server.原先一直都是LAMP.如今改为LNMP. 将重写文件 htaccess改成 nginx的 conf.放到了站点.可仅仅能打开首页,其它重写页面一打开都是不停的载入. 载入等 ...

  6. WebStorm 7.0 注冊码

    经測试 WebStorm 6 7均能够使用例如以下注冊码,简直就是神key啊! WebStorm 6.0 7.0 注冊码 User Name: EMBRACE   License Key: ===== ...

  7. 算法精解(C语言描述) 第4章 读书笔记

    第4章 算法分析 1.最坏情况分析 评判算法性能的三种情况:最佳情况.平均情况.最坏情况. 为何要做最坏情况分析: 2.O表示法 需关注当算法处理的数据量变得无穷大时,算法性能将趋近一个什么样的值.一 ...

  8. 虚拟键盘,移动web开发的痛

    原生APP的弹出虚拟键盘和收回虚拟键盘,输入框始终贴在虚拟键盘的上方.如下图: 如果移动端web也想做类似的功能,可以实现吗?  你可能会说着:“不就是放一个position: fixed;的输入框在 ...

  9. 【图像配准】基于灰度的模板匹配算法(一):MAD、SAD、SSD、MSD、NCC、SSDA、SATD算法

    简介: 本文主要介绍几种基于灰度的图像匹配算法:平均绝对差算法(MAD).绝对误差和算法(SAD).误差平方和算法(SSD).平均误差平方和算法(MSD).归一化积相关算法(NCC).序贯相似性检测算 ...

  10. matlab如何保存figure中去掉白边的图片

    输出图片成可直接调入的灰度图,设置输出图片空白边距,以及调整图片大小,纵横比. 一.先显示图片,imshow.如果是plot,或者newplot,直接看“三”.imshow(strain_image, ...