天天看点

1011 A+B 和 C(JAVA)

输入格式:

输出格式:

输入样例:

4
1 2 3
2 3 4
2147483647 0 2147483646
0 -2147483648 -2147483647      

输出样例:

Case #1: false
Case #2: true
Case #3: true
Case #4: false      

实现代码:

import java.util.Scanner;

/**
 * @author yx
 * @date 2022-07-12 17:19
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n=scanner.nextInt();
        for (int i = 1; i <= n; i++) {
            long a=scanner.nextInt();
            long b=scanner.nextInt();
            long c=scanner.nextInt();
            if(a+b>c){
                System.out.println("Case #"+i+": true");
            }else {
                System.out.println("Case #"+i+": false");
            }
        }
    }
}      

继续阅读