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 ...
随机推荐
- TCP/IP与UDP区别
最近面试,问到这方面的问题,这里总结一下: TCP (Transmission Control Protocol 传输控制协议):面向连接的,不可靠的,数据流服务.UDP (User Dat ...
- JS中获取table节点的tr或td的内容
<table id="tb1" width="200" border="1" cellpadding="4" ce ...
- XShell提示Connection closed by foreign host的问题 和 路由器分配IP的规则
情况是这样的: VMware中有三个Linux机器分别是crxy99(192.168.1.99),crxy100(192.168.1.100),crxy101(192.168.1.101),crxy1 ...
- asp.net的CascadingDropDown取值和赋值
获取选择的值 可以使用形如以下的方式获得选择的值: Label1.Text = ddlProvince.SelectedValue; Label2.Text=ddlCity.Select ...
- mysql数据库千万级别数据的查询优化和分页测试
原文地址:原创 mysql数据库千万级别数据的查询优化和分页测试作者:于堡舰 本文为本人最近利用几个小时才分析总结出的原创文章,希望大家转载,但是要注明出处 http://blog.sina.com. ...
- 一步步搭建自己的轻量级MVCphp框架-(一)什么是PHP框架以及MVC设计模式
PHP框架 php框架对很多新手而言可能会觉得很难攀越,其实不然 ,只要知道一个框架的流程,明白原理了,基本类似框架都可以看懂,php框架真正的发展要从php5开始了,其实php4时代就有一些框架,但 ...
- Httpclient 和jsoup结和提取网页内容(某客学院视频链接)
最近在极客学院获得体验会员3个月,然后就去上面看了看,感觉课程讲的还不错.整好最近学习Android,然后去上面找点视频看看.发现只有使用RMB买的会员才能在上面下载视频.抱着试一试的态度,去看他的网 ...
- usp_Copy_Unzip_DirFiles -- 拷贝,解压,列出文件名 from FTP Folder to Work Folder
CREATE PROC usp_Copy_Unzip_DirFiles @FTPPath NVARCHAR(4000)= '', -- ftp 文件夹路径 @WorkPath NVARCHAR(400 ...
- CSS之导航菜单
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- JQuery中操作表单和表格
一:表单应用 1.HTML中的表单大致由三部分组成 (1).表单便签:包含处理表单数据所用的服务端程序URL,以及数据提交到服务器的方法. (2).表单域:包含文本框.密码框.隐藏域.多行文本框.复选 ...