解题思路:
注意事项:
参考代码:
import java.util.Scanner;
/**************题目 1089: A+B for Input-Output Practice (V)**********************/
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt(); // n组数据
int[] array = new int[n];
for (int i = 0; i < n ; i++) {
int sum = 0;
int x = sc.nextInt(); // 每组数据多少个
for (int j = 0; j < x ; j++) {
int a = sc.nextInt();
sum+=a;
}
array[i] = sum;
}
for (int i = 0; i < n; i++) {
System.out.println(array[i]);
}
}
}
0.0分
0 人评分
模拟计算器 (C语言代码)浏览:892 |
C语言训练-求函数值 (C语言代码)浏览:939 |
C语言程序设计教程(第三版)课后习题6.3 (C语言代码)浏览:512 |
C语言程序设计教程(第三版)课后习题5.4 (C语言代码)浏览:900 |
C语言程序设计教程(第三版)课后习题8.2 (C语言代码)浏览:5232 |
母牛的故事 (C语言代码)浏览:1428 |
DNA (C语言描述,蓝桥杯)浏览:1555 |
C语言程序设计教程(第三版)课后习题10.7 (C语言代码)浏览:669 |
C语言程序设计教程(第三版)课后习题7.2 (C语言代码)浏览:754 |
小O的图案 (C语言代码)浏览:915 |