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 }