姓名对称排序
来源:互联网 发布:中国银行网络金融 编辑:程序博客网 时间:2024/05/21 13:53
#include <iostream>#include <cstring>#include <algorithm>using namespace std;struct str{ string s; int len;};bool cmp(str a,str b){ return a.len<b.len;}int main(){ int n,m=0; while(1) { cin>>n; if(n==0) break; str a[n]; for(int i=0;i<n;++i) { cin>>a[i].s; a[i].len=a[i].s.length(); } ++m; cout<<"SET "<<m<<endl; sort(a,a+n,cmp); for(int i=0;i<n;i+=2) { cout<<a[i].s<<endl; } if(n%2==1) n-=1; for(int i=n-1;i>=1;i-=2) { cout<<a[i].s<<endl; } } return 0;}
0 0
- 姓名对称排序
- 对称排序
- 对称排序
- 对称排序
- 对称排序
- 对称排序
- 对称排序
- 对称排序
- 对称排序
- 通讯录联系人姓名排序
- mysql 姓名首字母排序
- 输入姓名编号排序
- 带姓名的成绩排序
- 按姓名,按成绩排序
- 姓名,年龄,成绩的排序
- Mysql,姓名按笔画排序
- 题目:283 对称排序
- NYOJ - 对称排序
- 活用mysql的binlog进行数据恢复
- 南邮 OJ 1998 GRID
- 前端之路
- 一种跨移动应用的消息推送方法和装置
- Android LayoutInflater详解
- 姓名对称排序
- 南邮 OJ 2000 水獭
- 原生JS焦点轮播图实现
- 实现二级列表双listview省市选择
- Light Bulb
- Android 在同一个手机上安装多个相同的apk,便于调试
- Java中的可变参数
- EDK2 环境搭建 & Shell-Debug(Microsoft Visual Studio 2013)
- 南邮 OJ 2001 水獭看动漫