绝对的水题,直接上代码:
/* THE PROGRAM IS MADE BY PYY */ /*----------------------------------------------------------------------------// http://acm.hdu.edu.cn/showproblem.php?pid=2000 ASCII码排序 Date : 2011/2/27 Thursday Begin : 14:00 End : 14:44 //----------------------------------------------------------------------------*/ #include <iostream> #include <algorithm> using namespace std; int main() { char str[4]; int i; while (cin >> str) { sort(str, str+3); for (i = 0; i < 2; i++) cout << str[i] << " "; cout << str[i] << endl; } return 0; }
======================================原题如下======================================
ASCII码排序
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 30044 Accepted Submission(s): 12230
Problem Description
输入三个字符后,按各字符的ASCII码从小到大的顺序输出这三个字符。
Input
输入数据有多组,每组占一行,有三个字符组成,之间无空格。
Output
对于每组输入数据,输出一行,字符中间用一个空格分开。
Sample Input
qwe
asd
zxc
Sample Output
e q w
a d s
c x z
Author
lcy
Source
C语言程序设计练习(一)
Recommend
JGShining