原题链接:Little Boxes
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 2542 Accepted Submission(s): 918 Problem Description Little boxes on the hillside.
Input The input has several test cases. The first line contains the integer t (1 ≤ t ≤ 10) which is the total number of test cases.
Output For each test case, output a line with the total number of boxes.
Sample Input
4 1 2 3 4 0 0 0 0 1 0 0 0 111 222 333 404
Sample Output
10 0 1 1070
Source 2017ACM/ICPC亚洲区沈阳站-重现赛(感谢东北大学)
Recommend jiangzijing2015
|
Python:
# HDU6225 UVALive8209 Little Boxes
n = int(input())
for i in range(0, n):
a,b,c,d = map(int, input().split())
print(a + b + c + d)
Java:
# HDU6225 UVALive8209 Little Boxes
import java.math.BigInteger;
import java.util.Scanner;
public class Main {
public static Scanner s = new Scanner(System.in);
public static void main(String args[]) throws Exception {
Scanner in = new Scanner(System.in);
int t = in.nextInt();
while(t-- != 0) {
BigInteger a = in.nextBigInteger();
BigInteger b = in.nextBigInteger();
BigInteger c = in.nextBigInteger();
BigInteger d = in.nextBigInteger();
System.out.println(a.add(b.add(c.add(d))));
}
}
}