题解 | 多组_一维数组_T组形式
多组_一维数组_T组形式
https://www.nowcoder.com/practice/90cdc8e31ef74b6e9fd44c1e03077b57
import java.util.Scanner; // 注意类名必须为 Main, 不要有任何 package xxx 信息 public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); // 注意 hasNext 和 hasNextLine 的区别 int t = in.nextInt(); while (t -- > 0) { long su = 0; int n = in.nextInt(); while (n -- > 0) { // 注意 while 处理多个 case su += in.nextLong(); } System.out.println(su); } } }