简单排序。题意较长。

#include<cstdio>
#include<cstring>
#include<cmath>
#include<queue>
#include<vector>
#include<string>
#include<stack>
#include<map>
#include<algorithm>
using namespace std; struct X
{
int id;
int v,t;
int f;
}s[+],tmp[+],Ans[+];
int n,L,H;
int tot; bool cmp(const X&a,const X&b)
{
if(a.t+a.v==b.t+b.v&&a.v==b.v) return a.id<b.id;
if(a.t+a.v==b.t+b.v) return a.v>b.v;
return a.t+a.v>b.t+b.v;
} int main()
{
scanf("%d%d%d",&n,&L,&H);
for(int i=;i<=n;i++) scanf("%d%d%d",&s[i].id,&s[i].v,&s[i].t);
for(int i=;i<=n;i++) s[i].f=; for(int i=;i<=n;i++) if(s[i].t<L||s[i].v<L) s[i].f=; tot=;
int ans=; for(int i=;i<=n;i++)
{
if(s[i].f==) continue;
if(s[i].t>=H&&s[i].v>=H)
{ tmp[tot++]=s[i];
s[i].f=;
}
} sort(tmp,tmp+tot,cmp);
for(int i=;i<tot;i++) Ans[ans++]=tmp[i];
tot=; for(int i=;i<=n;i++)
{
if(s[i].f==) continue;
if(s[i].t<H&&s[i].v>=H)
{ tmp[tot++]=s[i];
s[i].f=;
}
} sort(tmp,tmp+tot,cmp);
for(int i=;i<tot;i++) Ans[ans++]=tmp[i];
tot=; for(int i=;i<=n;i++)
{
if(s[i].f==) continue;
if(s[i].t<H&&s[i].v<H&&s[i].v>=s[i].t)
{ tmp[tot++]=s[i];
s[i].f=;
}
} sort(tmp,tmp+tot,cmp);
for(int i=;i<tot;i++) Ans[ans++]=tmp[i];
tot=; for(int i=;i<=n;i++)
{
if(s[i].f==) continue; tmp[tot++]=s[i];
s[i].f=; } sort(tmp,tmp+tot,cmp);
for(int i=;i<tot;i++) Ans[ans++]=tmp[i];
tot=; printf("%d\n",ans);
for(int i=;i<ans;i++)
{
printf("%08d %d %d\n",Ans[i].id,Ans[i].v,Ans[i].t);
}
return ;
}

PAT (Advanced Level) 1062. Talent and Virtue (25)的更多相关文章

  1. 【PAT甲级】1062 Talent and Virtue (25 分)

    题意: 输入三个正整数N,L,H(N<=1E5,L>=60,H<100,H>L),分别代表人数,及格线和高水平线.接着输入N行数据,每行包括一个人的ID,道德数值和才能数值.一 ...

  2. 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 ...

  3. PAT 甲级 1062 Talent and Virtue (25 分)(简单,结构体排序)

    1062 Talent and Virtue (25 分)   About 900 years ago, a Chinese philosopher Sima Guang wrote a histor ...

  4. 1062 Talent and Virtue (25)

    /* L (>=60), the lower bound of the qualified grades -- that is, only the ones whose grades of ta ...

  5. 1062 Talent and Virtue (25分)(水)

    About 900 years ago, a Chinese philosopher Sima Guang wrote a history book in which he talked about ...

  6. pat 1062. Talent and Virtue (25)

    难得的一次ac 题目意思直接,方法就是对virtue talent得分进行判断其归属类型,用0 1 2 3 4 表示 不合格 sage noblemen foolmen foolmen 再对序列进行排 ...

  7. PAT甲题题解-1062. Talent and Virtue (25)-排序水题

    水题,分组排序即可. #include <iostream> #include <cstdio> #include <algorithm> #include < ...

  8. PAT (Advanced Level) 1113. Integer Set Partition (25)

    简单题. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #in ...

  9. PAT (Advanced Level) 1110. Complete Binary Tree (25)

    判断一棵二叉树是否完全二叉树. #include<cstdio> #include<cstring> #include<cmath> #include<vec ...

随机推荐

  1. hdu_4539_郑厂长系列故事——排兵布阵(状压DP|最大团)

    题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=4539 题意:中文,不解释 题解:将每一行的状态压缩,然后进行DP,也可以用最大团做.这里我用的DP # ...

  2. Boxes in a Line(移动盒子)

      You have n boxes in a line on the table numbered 1 . . . n from left to right. Your task is to sim ...

  3. openwrt下加载snmp模块

    加snmp模块到openwrt中去 1.下载snmp的解压包文件 net-snmp-5.4.2.1.tar.gz 下载地址为:http://www.net-snmp.org/download.html ...

  4. java FLOAT

    System.out.println(""+ 1/2); 得不到0.5,只能得到0. 要想打印出浮点数,必须除数和被除数至少有一个是浮点数,像这样: System.out.prin ...

  5. 运维命令rsync

    如果你是一位运维工程师,你很可能会面对几十台.几百台甚至上千台服务器,除了批量操作外,环境同步.数据同步也是必不可少的技能. 说到“同步”,不得不提的利器就是rsync,今天就来说说我从这个工具中看到 ...

  6. SQL SERVER与C#的数据类型对应表

    序号 类别 SQLServer C Sharp 备注 1 整数 bit Boolean True转换为1False转换为0 2 tinyint Byte C Sharp 数据类型都位于System命名 ...

  7. vs 发布web应用程序时,找不到cs文件错误

    将*.aspx.*.ascx.*.master所有出错页面文件中的 CodeFile="******.aspx.cs" 批量替换成 Codebehind="******. ...

  8. linux下如何开放80端口

    linux清屏命令:clear linux版本:CentOS6.5 1.开启80端口命令:/sbin/iptables -I INPUT -p tcp --dport 80 -j ACCEPT2.保存 ...

  9. perl-cgi高级

    来源: http://www.cnblogs.com/itech/archive/2012/10/07/2714393.html 一 CGI.pm中的方法(routines)调用  1. CGI.pm ...

  10. 把perl脚本编译成exe

    来源:http://www.veryhuo.com/a/view/38338.html 今天想把 perl 脚本编译成 exe 以便脱离 perl 解释器独立运行.都可以生成PERL的PE文件,在PE ...