HDU 2000 (水)

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

题目大意:仨字符从小到大排序

解题思路

很水很水,需要注意的地方是如果用苦力(三个if)要注意正确写法是

        if(x >= y){ t = x; x = y; y = t; }
        if(x >= z){ t = x; x = t; z = t; }
        if(y >= z){ t = y; y = z; z = t; }

或者

        if(x > y){  t = x;  x = y; y = t; }
        if(y > z){  t = y;  y = z; z = t; }
        if(x > y){  t = x;  x = y; y = t; }

如果写成

        if(x >= y){t = x; x = y; y = t; }
        if(y >= z){t = y; y = t; z = t; }
        if(x >= z){t = x; x = z; z = t; }

 是铁定过不了的,比如190,会变成109,而非019.

猜你喜欢

转载自www.cnblogs.com/mimangdewo-a1/p/9351722.html