輸入描述
輸入的第一行為一個整數(shù)N,接下來N行每行先輸入一個整數(shù)M,然后在同一行內(nèi)輸入M個整數(shù)。
輸出描述
對于每組輸入,輸出M個數(shù)的和,每組輸出之間輸出一個空行。
輸入示例
3 (后面會有3行)
4 1 2 3 4 第一個4 所以后面會有4個數(shù)
5 1 2 3 4 5
3 1 2 3?3 1 2 3
輸出示例
10
15
6
解題思路
后面還會有對個N的輸入,所以會有一個大循環(huán),參考 第二天內(nèi)容
while True:
try:
N = int(input())?N = int(input())
for i in rang(N) : 表示 i 會取從0到N-1,每次循環(huán)都會執(zhí)行下面的步驟
input_line= input().split()?input_line= input().split()
p = int (input_line[0])?p = int (input_line[0])
total = 0?總計 = 0
for j in range(p):?對于 P 中的 J:
total = total + int(int_line[j+1])? 或者寫total += int(input_line[j + 1])
total = total + int(int_line[j+1]) 或者寫total += int(input_line[j + 1])
print(total)?打?。傆嫞?/p>
if i < N-1:
print()?如果我
except:
break?除了