题解 | #表达式求值#

表达式求值

http://www.nowcoder.com/practice/3e483fe3c0bb447bb17ffb3eeeca78ba

import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] arr = new int[3];
        arr[0] = sc.nextInt();
        arr[1] = sc.nextInt();
        arr[2] = sc.nextInt();
        Arrays.sort(arr);
        if(arr[1] + arr[0] > arr[1] * arr[0]) {
            System.out.println(arr[2] * (arr[1] + arr[0]));
        } else {
            System.out.println(arr[2] * arr[1] * arr[0]);
        }
    }
}
全部评论

相关推荐

鬼迹人途:你去投一投尚游游戏,服务器一面,第一个图算法,做完了给你一个策略题,你给出方案他就提出低概率问题,答不上当场给你挂
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务