题意:给4个整数,2^62的范围
好像四个相加也不需要大数模拟吧?
但是只开long long过不了
1 import java.math.BigInteger; 2 import java.util.Scanner; 3 4 public class Main { 5 public static void main(String[] args) { 6 Scanner input = new Scanner(System.in); 7 int T = input.nextInt(); 8 for(int i = 1; i <=T; i++){ 9 BigInteger ans = new BigInteger("0"); 10 String s; 11 for(int k = 1; k <= 4; k++){ 12 s=input.next(); 13 BigInteger tmp = new BigInteger(s); 14 ans=ans.add(tmp); 15 } 16 System.out.println(ans); 17 } 18 } 19 }
原文:https://www.cnblogs.com/pangbi/p/14362641.html