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. attempting to bokeyaunrun eclipse useing the jre instead of jdk,to run eclipse using

    关于eclipse运行出现,attempting to bokeyaunrun eclipse useing the jre instead of jdk,to run eclipse using错误 ...

  2. css区块定位之浮动与清除属性

    float属性将所属标记的显示空间指定为一个浮动元素,并使其周围对象按一定的方式环绕它排列. float属性的作用就象图像和表格的align属性一样,但可以用到任何元素上. clear属性的作用是禁止 ...

  3. php中禁止非法调用和硬路径引入文件的方法

    php中禁止非法调用和硬路径引入文件的方法 在php中有一些公共的文件为了方便,我们会做一个公共文件,让不用的文件共同调用.为了禁止公共文件被非常单独调用,可以在文件上做一个常量,禁止非常调用:在公共 ...

  4. Continue

    Continue 其作用为结束本次循环.即跳出循环体中下面尚未执行的语句. 对于while循环,继续求解循环条件. 对于for循环程序流程接着求解for语句头中的第三个部分expression表达式. ...

  5. 不能取组织ID

    应用 Oracle   Purchasing 层 Level Function 函数名 Funcgtion Name PO_POXBWVRP 表单名 Form Name POXBWVRP 说明 Des ...

  6. 利用新版ShareSDK进行手动分享(自定义分享界面)

    之前有用过Share SDK进行快捷分享,可是官方demo中的快捷分享的界面已经设置死了,而公司的产品又设计了自己的分享界面,这就需要我进行手动分享了.当前ShareSDK版本是2.5.4. 看了一堆 ...

  7. python 正则表达式 学习笔记(不断补充ing)

    本文参考了以下博客,感谢众位大神的分享! http://www.oschina.net/question/12_9507 和 http://www.crifan.com/python_re_sub_d ...

  8. 利用虚拟光驱实现 将WINDOWS文件供虚拟机中的UBUNTU共享

    此方法只能实现(至少目前我发现只能这样)将文件传递给虚拟机中的ubuntu 中,供ubuntu系统阅读,拷贝等,但不能将ubuntu中的数据传递给windows. 即:每次更新windows的数据到u ...

  9. SurfaceView 和 View 区别

    android.view.View 和 android.view.SurfaceView SurfaceView 是从 View 基类中派生出来的显示类,直接子类有 GLSurfaceView和Vid ...

  10. 转 C#中静态方法与非静态方法区别比较

    C#静态方法与非静态方法的区别不仅仅是概念上的,那么他们有什么具体的区别呢?让我们通过本文向你做一下解析. C#的类中可以包含两种方法:C#静态方法与非静态方法.那么他们的定义有什么不同呢?他们在使用 ...