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 ...
随机推荐
- html笔记01:顺序和无序列表
<!DOCTYPE html> <html> <body> <li>Yellow <ul><li>Wet soil</li ...
- jQuery插件面向对象开发
为什么要有面向对象的思维,因为如果不这样,你可能需要一个方法的时候就去定义一个function,当需要另外一个方法的时候,再去随便定义一个function,同样,需要一个变量的时候,毫无规则地定义一些 ...
- CentOS(二)--初识linux的一些常用命令
linux命令是对Linux系统进行管理的命令.对于Linux系统来说,无论是中央处理器.内存.磁盘驱动器.键盘.鼠标,还是用户等都是文件,Linux系统管理的命令是它正常运行的核心,与之前的DOS命 ...
- Oracle中exists与in的区别
有两个简单例子,以说明 "exists"和"in"的效率问题 1) select * from T1 where exists(select 1 from T2 ...
- LeetCode 122
Best Time to Buy and Sell Stock II Say you have an array for which the ith element is the price of a ...
- [改善Java代码]不能初始化泛型参数和数组
泛型类型在编译期被擦除,我们在类初始化时将无法获得泛型的具体参数,比如这样的代码: class Foo<T>{ //private T t =new T();//报错Cannot inst ...
- HTML5와 CSS3 적용기
HTML5의 DTD 선언 <!DOCTYPE html> HTML5의 인코딩 선언 <meta charset="utf-8"> 그리고나서는 새로 ...
- Linux 命令 - umask: 显示或设置文件模式掩码值
umask 命令控制着创建文件时指定给文件的默认权限.它使用八进制表示法从文件模式属性中删除一个位掩码. 参见下面的例子: [huey@huey-K42JE cmdline]$ rm -f foo.t ...
- 每天一道LeetCode--172. Factorial Trailing Zeroes
Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in log ...
- JAVA鼠标屏幕绘制拖拽删除矩形
import java.awt.Cursor; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; ...