I-Little Boxes【大数】

hdu6225  http://acm.hdu.edu.cn/showproblem.php?pid=6225

题意:

就是给四个大数,输出和。

思路:

java大法好。用long longWA了一发

 1 import java.math.BigInteger;
 2 import java.util.Scanner;
 3 
 4 public class Main {
 5 
 6     //static Scanner scan;
 7     //static BigInteger a, b, c, d;
 8     static public void main(String[] args){
 9         Scanner scan = new Scanner(System.in);
10         int t = scan.nextInt();
11         BigInteger a, b, c, d;
12         for(int i = 0; i < t; i++){
13             a = scan.nextBigInteger();
14             b = scan.nextBigInteger();
15             c = scan.nextBigInteger();
16             d = scan.nextBigInteger();
17             BigInteger ans = a.add(b).add(c).add(d);
18 
19             System.out.println(ans);
20         }
21 
22     }
23 }
View Code

相关文章:

  • 2022-12-23
  • 2021-11-05
  • 2021-09-14
  • 2022-12-23
  • 2021-10-09
  • 2021-06-13
  • 2021-07-28
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-31
  • 2021-07-18
相关资源
相似解决方案