1055. The World's Richest (25)
来源:互联网 发布:cf卡误删数据恢复 编辑:程序博客网 时间:2024/06/18 13:06
//1055. The World's Richest (25)#include<cstdio>#include<cstring>#include<algorithm>using namespace std;struct people{ char name[10]; int age; int worth;}People[100000];bool cmp(people a, people b){ if(a.worth!=b.worth) return a.worth>b.worth; else if(a.age!=b.age) return a.age<b.age; else return strcmp(a.name,b.name)<0;}int main(){ int N=0,K=0,M=0; int Amin=0,Amax=0; int i=0,j=0,x=0,flag=0; scanf("%d %d",&N,&K); while(i<N) { scanf("%s %d %d",People[i].name,&People[i].age,&People[i].worth); i++; } sort(People, People+N, cmp); i=0; while(i<K) { scanf("%d %d %d",&M,&Amin,&Amax); printf("Case #%d:\n",i+1); x = 0; j = 0; while(j<N) { if(People[j].age>=Amin && People[j].age<=Amax && x<M) { printf("%s %d %d\n",People[j].name,People[j].age,People[j].worth); x++; } j++; } if(x == 0) printf("None\n"); i++; } return 0;}
0 0
- 【PAT】1055. The World's Richest (25)
- pat 1055. The World's Richest (25)
- pat 1055. The World's Richest (25)
- 1055. The World's Richest (25)
- 1055. The World's Richest (25)
- 1055. The World's Richest (25)
- 1055. The World's Richest (25)
- PAT: 1055. The World's Richest (25)
- 1055. The World's Richest (25)
- 1055. The World's Richest (25)
- 1055. The World's Richest (25)
- 1055. The World's Richest (25)
- 1055. The World's Richest (25)
- 1055. The World's Richest (25)
- 1055. The World's Richest (25)
- PAT 1055. The World's Richest (25)
- 1055. The World's Richest (25)
- 1055. The World's Richest (25)
- centos下 lnmp1.3安装 exif扩展
- php 条件语句if ,switch
- JSP文件中路径问题
- vlc_for_android(基于git-3.0.0)快速集成
- java学习【知识点及代码12.2】
- 1055. The World's Richest (25)
- c语言 ——回文
- POJ 1093 Formatting Text 笔记
- A*算法详解
- 1058. A+B in Hogwarts (20)
- 贪心算法基础之任务执行顺序 51nod 贪心教程
- 3个整数中最大的数和最小的数
- Linux 高级I/O函数
- RCC 2017 Qual 1 Mail.Ru, April 2, 2017 Problem B. Painting the Wall