刘家有


私信TA

用户名:2007020105

访问量:6102

签 名:

生活不止眼前的苟且,还有远方的苟且。

等  级
排  名 938
经  验 3317
参赛次数 3
文章发表 18
年  龄 0
在职情况 学生
学  校 博达
专  业

  自我简介:

解题思路:三个数就不排序了,一一考虑所有情况;



注意事项:

参考代码:import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner sc = new Scanner(System.in);
        int a,b,c;
        a=sc.nextInt();
        b=sc.nextInt();
        c=sc.nextInt();
        if(a>b) {
            if(b>c) {
                System.out.println(c+" "+b+" "+a);
            }
            else {
                if(a>c) {
                    System.out.println(b+" "+c+" "+a);
                }
                else {
                    System.out.println(b+" "+a+" "+c);
                }
                
                
            }
        }
        else {//b>a
            if(a>c) {
                System.out.println(c+" "+a+" "+b);
            }
            else {
                if(b>c) {
                    System.out.println(a+" "+c+" "+b);
                }
                else {
                    System.out.println(a+" "+b+" "+c);
                }
            }
        }
        
    }

}


 

0.0分

4 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区