杭电ACM2000 自我感悟

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_33896101/article/details/60779132

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

思路:先固定两点,再分别在三个位置插入第三点,6种情况。

#include <stdio.h>
int main() {
char m,n,q;
while(scanf("%c%c%c",&m,&n,&q)!=EOF){
getchar();//吸收回车带来的字符 
if(m<=n){
if(q<=m)
printf("%c %c %c\n",q,m,n);
else if(q>=n)
printf("%c %c %c\n",m,n,q);
else if(q<n)
printf("%c %c %c\n",m,q,n);
}
else{
if(q>=m)
printf("%c %c %c\n",n,m,q);
else if(q<=n)
printf("%c %c %c\n",q,n,m);
else if(q<m)
printf("%c %c %c\n",n,q,m);
}
}
return 0;
}

猜你喜欢

转载自blog.csdn.net/qq_33896101/article/details/60779132