A1062 Talent and Virtue (25)
来源:互联网 发布:串口数据采集软件 编辑:程序博客网 时间:2024/06/05 20:16
未完成的代码
#include<cstdio>#include<algorithm>using namespace std;struct Grade{int num,de,cai,sum,flag;}stu[100010];bool cmp(Grade a,Grade b){if(a.flag!=b.flag) return a.flag < b.flag;else if(a.sum!=b.sum) return a.sum > b.sum;else if(a.de!=b.de) return a.de > b.de;else return a.num < b.num;}int main(){int n,l,h,m = 0;scanf("%d %d %d",&n,&l,&h);for(int i =0;i < n;i++){scanf("%d %d %d",&stu[i].num,&stu[i].de,&stu[i].cai);stu[i].sum = stu[i].de + stu[i].cai;if(stu[i].de>=h && stu[i].cai >= h) stu[i].flag = 1;else if(stu[i].de >= h&&stu[i].cai >= l&&stu[i].cai<h) stu[i].flag = 2;else if(stu[i].cai>=l&&stu[i].cai< h && stu[i].de>=stu[i].cai&&stu[i].de>=l&&stu[i].de<h) stu[i].flag = 3;else if(stu[i].de<l || stu[i].cai < l){ stu[i].flag = 5;}else stu[i].flag = 4;}sort(stu,stu+n,cmp);while(stu[m].flag<5 && m<=n) m++; printf("%d\n",m);for(int i = 0;i < m;i++)printf("%d %d %d\n",stu[i].num,stu[i].de,stu[i].cai);return 0;}
0 0
- A1062 Talent and Virtue (25)
- A1062. Talent and Virtue (25)
- PAT---A1062. Talent and Virtue (25)
- PAT A1062. Talent and Virtue (25)
- PAT A1062. Talent and Virtue (25)
- PAT-A1062. Talent and Virtue (25)(排序)
- B1015. 德才论 /A1062. Talent and Virtue(25)
- 1062. Talent and Virtue (25)
- 1062. Talent and Virtue (25)
- 1062. Talent and Virtue (25)
- 1062. Talent and Virtue (25)
- 1062. Talent and Virtue (25)
- 1062. Talent and Virtue (25)
- 1062. Talent and Virtue (25)
- 1062. Talent and Virtue (25)
- 1062. Talent and Virtue (25)
- 1062. Talent and Virtue (25)
- 1062. Talent and Virtue (25)
- 需要这样一个记事本-15 ReportViewer打印默认页边距、页面方向问题
- 值得一看的博客
- linux3.2下adt7320的spi驱动编写
- POJ1149 PIGS (最大流)
- 大数据专家Bernard Marr:大数据是如何对抗癌症的?
- A1062 Talent and Virtue (25)
- (四) Basic Build Customization(基本的构建定制 :签名,构建,混淆)
- 两段函数求值
- poj 2752 Seek the Name, Seek the Fame
- 浅析JVM
- 数据结构基础(24) --红黑树的设计与实现(下)
- 字符串数组
- 搭建SpringMVC开发环境
- 如何中断线程?