字符串排序 (sdut oj)
来源:互联网 发布:淘宝双立人指甲钳 编辑:程序博客网 时间:2024/05/16 05:49
字符串排序
Time Limit: 1000MS Memory Limit: 65536KB
Problem Description
输入3个字符串,按字典序从小到大进行排序。
Input
输入数据有一行,分别为3个字符串,用空格分隔,每个字符串长度不超过100。
Output
输出排序后的三个字符串,用空格分隔。
Example Input
abcd cdef bcde
Example Output
abcd bcde cdef
Hint
Author
参考代码
#include<stdio.h>#include<string.h>void stor_str(char a[][200],int n){ int i,j; char t[200]; for(i = 0; i < n; i++) { for(j = 0; j < n - i - 1; j++) { if(strcmp(a[j],a[j+1]) > 0) { strcpy(t,a[j]); strcpy(a[j],a[j+1]); strcpy(a[j+1],t); } } }}int main(){ char s[3][200]; int i; for(i = 0; i < 3; i++) { scanf("%s",s[i]); } stor_str(s,3); for(i = 0; i < 3; i++) { printf("%s ",s[i]); } return 0;}
0 0
- 字符串排序 (sdut oj)
- 简单字符串排序 (sdut oj)
- 排序 (sdut oj)
- 排序问题 (sdut oj)
- SDUT-oj 字符串扩展
- 交叉排序 sdut oj 1591
- SDUT OJ 1591交叉排序
- 简单字符串比较 (sdut oj)
- SDUT-1201 字符串排序
- sdut 字符串排序
- sdut acm 简单字符串排序
- SDUT-1334 简单字符串排序
- n个数的排序 (sdut oj)
- 华为OJ 字符串排序
- 【华为OJ】字符串排序
- 华为oj 字符串排序
- 华为OJ 字符串排序
- 【华为 OJ 】字符串排序
- selenium调用浏览器出现奔溃,或者只调用浏览器后,不输入地址
- xml中CDATA
- JavaMail发送的方式
- mapshaper系列之三 - I/O命令
- C++继承
- 字符串排序 (sdut oj)
- FlashFXP软件设置并关联默认编辑器
- 【NOIP2014】飞扬的小鸟
- 使用SocketServer创建TCP/UDP同步服务器
- React Native 项目常用第三方组件汇总
- 1059. Prime Factors (25)
- Integer与int的区别
- iOS 常用动画第三方
- P1130 红牌(洛谷)