1062 Talent and Virtue (25)
/* L (>=60), the lower bound of the qualified grades --
that is, only the ones whose grades of talent and virtue are both not below
this line will be ranked; and H (<100), the higher line of qualification ,those with both grades not below this line are considered as the "sages",
and will be ranked in non-increasing order according to their total grades. Those with talent grades below H but virtue grades not are cosidered as
the "noblemen", and are also ranked in non-increasing order according to
their total grades, but they are listed after the "sages". Those with both grades below H,
but with virtue not lower than talent are considered as the "fool men".
They are ranked in the same way but after the "noblemen". The rest of people whose grades both pass the L line are ranked
after the "fool men". */ #include <string.h>
#include <algorithm>
#include <vector>
#include <stdio.h>
using namespace std; struct peo
{
char num[];
int all,t,v;
int id;
}; bool cmp(peo a,peo b)
{
if(a.id==b.id)
{
if(a.all == b.all)
{
if(a.v == b.v )
return (strcmp(a.num,b.num)<);
else return a.v > b.v;
}
else return a.all > b.all;
}
else return a.id<b.id; } int main()
{ int i,n,low,high,v,t;
char num[];
while(scanf("%d%d%d",&n,&low,&high)!=EOF)
{ vector<peo> VP;
for(i=;i<n;i++)
{
getchar();
scanf("%s %d %d",num,&v,&t);
if(t>=low && v>=low)
{
peo pp;
strcpy(pp.num,num);
pp.v=v;
pp.t=t;
pp.all=v+t;
if(v>=high && t>=high)
pp.id=;
else if(v>= high && t<high)
pp.id=;
else if(v< high && t< high && v>=t)
pp.id=;
else
pp.id=; VP.push_back(pp);
}
} sort(VP.begin(),VP.end(),cmp);
printf("%d\n",VP.size());
for(i=;i<VP.size();i++)
printf("%s %d %d\n",VP[i].num,VP[i].v,VP[i].t); }
return ;
}
1062 Talent and Virtue (25)的更多相关文章
- 1062. Talent and Virtue (25)【排序】——PAT (Advanced Level) Practise
题目信息 1062. Talent and Virtue (25) 时间限制200 ms 内存限制65536 kB 代码长度限制16000 B About 900 years ago, a Chine ...
- PAT 甲级 1062 Talent and Virtue (25 分)(简单,结构体排序)
1062 Talent and Virtue (25 分) About 900 years ago, a Chinese philosopher Sima Guang wrote a histor ...
- 1062 Talent and Virtue (25分)(水)
About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked about ...
- pat 1062. Talent and Virtue (25)
难得的一次ac 题目意思直接,方法就是对virtue talent得分进行判断其归属类型,用0 1 2 3 4 表示 不合格 sage noblemen foolmen foolmen 再对序列进行排 ...
- PAT (Advanced Level) 1062. Talent and Virtue (25)
简单排序.题意较长. #include<cstdio> #include<cstring> #include<cmath> #include<queue> ...
- PAT甲题题解-1062. Talent and Virtue (25)-排序水题
水题,分组排序即可. #include <iostream> #include <cstdio> #include <algorithm> #include < ...
- 【PAT甲级】1062 Talent and Virtue (25 分)
题意: 输入三个正整数N,L,H(N<=1E5,L>=60,H<100,H>L),分别代表人数,及格线和高水平线.接着输入N行数据,每行包括一个人的ID,道德数值和才能数值.一 ...
- pat1062. Talent and Virtue (25)
1062. Talent and Virtue (25) 时间限制 200 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Li Abou ...
- 1062 Talent and Virtue (25 分)
1062 Talent and Virtue (25 分) About 900 years ago, a Chinese philosopher Sima Guang wrote a history ...
随机推荐
- Android(java)学习笔记109:通过反射获取成员变量和成员方法并且使用
一.反射获取成员变量并且使用: 1.获取字节码文件对象: Class c = Class.forName("cn.itcast_01.Person"); 2.使用无 ...
- python(3)-集合
集合就是把不同的元素组织在一起,但在集合中不允许有重复的元素. >>> a = set() #创建集合 >>> type(a) <class 'set'> ...
- SqlServer高版本数据本分还原到低版本方法
最近遇见一个问题: 想要将Sqlserver高版本备份的数据还原到低版本SqlServer上去,但是这在SqlServer中是没法直接还原数据库的,所以经过一系列的请教总结出来一下可用方法. 首先.你 ...
- java+mysql实现保存图片到数据库,以及读取数据库存储的图片
一:建表 二:获取数据库连接 1:导入mysql的驱动jar包,mysql-connector-java-5.1.8-bin.jar 2:写代码连接数据库,如下: /** * */ package c ...
- mysql数据库千万级别数据的查询优化和分页测试
原文地址:原创 mysql数据库千万级别数据的查询优化和分页测试作者:于堡舰 本文为本人最近利用几个小时才分析总结出的原创文章,希望大家转载,但是要注明出处 http://blog.sina.com. ...
- crontab执行java命令失效
一.我们常常碰到在shell下执行某个命令能够成功,比如执行一个java程序: java -jar /home/opscoder/topo-audit.jar,但是在crontab下执行会失败. co ...
- VSX规划Package文件
VSX是VS扩展,可以针对不同项目编写插件,虽然接触VSX的时间并不多,但是当了解VSX后深刻感受到VSX的魅力. VSX的材料比较少,配置文件也很繁琐,当初我也走了不少弯路. 这篇文章将帮助您更好的 ...
- Linux 命令 - chown: 更改文件的所有者和所属群组
chown 命令用来更改文件或者目录的所有者和所属群组.使用这个命令需要超级用户的权限. 命令格式 chown [OPTION]... [OWNER][:[GROUP]] FILE... chown ...
- django 学习-3 模板变量
1.vim learn/home.html <!DOCTYPE html><html><head> <title>{{title}}< ...
- c#中网络异常的处理办法
加入try catch来判断,catch使用的WebException来处理 try { var request = WebRequest.Create(uri); using (var respon ...