杭电hdu 2000 ASCII码排序

    技术2022-05-20  43

    绝对的水题,直接上代码:

    /* 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 Inputqweasdzxc 

    Sample Outpute q wa d sc x z 

    Authorlcy 

    SourceC语言程序设计练习(一)  

    RecommendJGShining


    最新回复(0)