zoukankan      html  css  js  c++  java
  • [PAT] 1065 A+B and C (64bit) (20 分)Java

    Given three integers A, B and C in [263​​,263​​], you are supposed to tell whether A+B>C.

    Input Specification:

    The first line of the input gives the positive number of test cases, T (10). Then T test cases follow, each consists of a single line containing three integers A, B and C, separated by single spaces.

    Output Specification:

    For each test case, output in one line Case #X: true if A+B>C, or Case #X: false otherwise, where X is the case number (starting from 1).

    Sample Input:

    3
    1 2 3
    2 3 4
    9223372036854775807 -9223372036854775808 0
    

    Sample Output:

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

     1 package pattest;
     2 
     3 
     4 import java.math.BigInteger;
     5 import java.util.Scanner;
     6 
     7 /**
     8  * @Auther: Xingzheng Wang
     9  * @Date: 2019/2/26 9:59
    10  * @Description: pattest
    11  * @Version: 1.0
    12  */
    13 public class PAT1065 {
    14     public static void main(String[] args) {
    15         Scanner sc = new Scanner(System.in);
    16         int num = sc.nextInt();
    17         for (int i = 1; i <= num; i++) {
    18             BigInteger a, b, c;
    19             a = sc.nextBigInteger();
    20             b = sc.nextBigInteger();
    21             c = sc.nextBigInteger();
    22             if ((a.add(b).compareTo(c)) > 0) {
    23                 System.out.println("Case #" + i +": true");
    24             }else{
    25                 System.out.println("Case #" + i +": false");
    26             }
    27         }
    28     }
    29 }


  • 相关阅读:
    Scale-Invariant Error
    Regularizing Deep Networks with Semantic Data Augmentation
    BBN: Bilateral-Branch Network with Cumulative Learning for Long-Tailed Visual Recognition
    2021.5.17
    2021.5.14
    2021.5.13
    2021.5.12
    2021.5.8
    2021.5.7 团队冲刺第十天
    2021.5.6 团队冲刺第九天
  • 原文地址:https://www.cnblogs.com/PureJava/p/10498106.html
Copyright © 2011-2022 走看看