题目http://acm.hdu.edu.cn/showproblem.php?pid=2000

第一遍写的代码如下

#include<stdio.h>
int main()
{
    char a,b,c,t;
    while(scanf("%c%c%c",&a,&b,&c)!=EOF)
    {
        if(a>b)
        {
            t=b;
            b=a;
            a=t;
        }
        if(b>c)
        {
            t=c;
            c=b;
            b=t;
        }
        if(a>b)
        {
            t=b;
            b=a;
            a=t;
        }
        printf("%c %c %c\n",a,b,c);
    

    }return 0;

}

但是很快就WRONG ANWSER 了,这是什么原因呢,改动后的如下

#include<stdio.h>
int main()
{
    char a,b,c,t;
    while(scanf("%c%c%c",&a,&b,&c)!=EOF)
    {
        if(a>b)
        {
            t=b;
            b=a;
            a=t;
        }
        if(b>c)
        {
            t=c;
            c=b;
            b=t;
        }
        if(a>b)
        {
            t=b;
            b=a;
            a=t;
        }
        printf("%c %c %c\n",a,b,c);
        t=getchar();



    }return 0;

}

 暂且认为是OJ认为

Sample Input
qwe
asd
zxc


Sample Output
e q w回车/换行
a d s回车/换行
c x z回车/换行

 

相关文章:

  • 2021-05-30
  • 2022-12-23
  • 2021-12-29
  • 2022-02-06
  • 2021-11-26
  • 2021-11-24
  • 2021-09-18
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-23
  • 2021-12-14
  • 2021-07-02
  • 2022-02-08
  • 2022-01-02
  • 2022-01-16
相关资源
相似解决方案