Nth Largest Value
来源:互联网 发布:火锅英雄 知乎 编辑:程序博客网 时间:2024/06/05 19:43
题目看起来比较难,写起来比较简单。
#include<stdio.h>#include<string.h>#include<algorithm>using namespace std;struct data{ char s[100]; int num;}a[25];bool cmp(data x,data y){ return x.num<y.num;}int main(){ int n,i,cas=0; while(~scanf("%d",&n)&&n) { getchar(); for(i=0;i<n;i++) { scanf("%s",a[i].s); a[i].num=strlen(a[i].s); getchar(); } sort(a,a+n,cmp); printf("SET %d\n",++cas); for(i=1;i<=n;i++) { if(i%2==1) printf("%s\n",a[i-1].s); } for(i=n;i>=1;i--) { if(i%2==0) printf("%s\n",a[i-1].s); } } return 0;}
0 0
- poj3781 Nth Largest Value
- Nth Largest Value
- hd 3279 Nth Largest Value
- Nth Largest Value
- HDU- 3279 - Nth Largest Value
- HDU 3279 Nth Largest Value
- HUD 3279 Nth Largest Value
- JAVA hdu 3279 Nth Largest Value
- hdoj 3279 Nth Largest Value 水过~
- POJ 3781 Nth Largest Value G++
- 【STL】poj 3781 Nth Largest Value
- http://poj.org/problem?id=3781&&Nth Largest Value
- C语言代码-水题poj3781--Nth Largest Value
- Find Nth maximum value in SQL Server
- (超水)Nth Largst Value(p3781)
- Find Largest Value in Each Tree Row
- Find Largest Value in Each Tree Row
- Find Largest Value in Each Tree Row
- 哈理工校园编程练习赛杭电 acm 4451 C . Dressing
- 折半查找
- 敏捷软件开发 原理、模式与实践 读书笔记
- 透过stats命令分析Memcached的内部状态
- String学习
- Nth Largest Value
- 10000 pcs free gift of chinese top grade brown film faced plywood
- vim文本编辑
- 哈理工校园编程练习赛杭电 acm 4442 E.Physical Examination
- 【0001】【深入解析Java中volatile关键字的作用】
- 树莓派安装raspbian系统
- 2/1+3/2+5/3+8/5+13/8+...前20项和
- vector容器用法详解
- 计算1-1/2+1/3-1/4+1/5 …… + 1/99 - 1/100的值