题解 | #多组_二维数组_T组形式#
多组_二维数组_T组形式
https://www.nowcoder.com/practice/fe1e902e076b46dd82e7d42e12617893
#include <iostream> #include <vector> using namespace std; int main() { int T; cin >> T; while (T--) { // 注意 while 处理多个 case long long int sum=0; int n, m; cin >> n >> m; while (n--) { vector<int>subArr; long long int subSum = 0; for (int i = 1; i <= m; i++) { int a; cin >> a; subArr.push_back(a); } for(auto subNode:subArr){ subSum+=subNode; } sum+=subSum; } printf("%lld\n", sum); } } // 64 位输出请用 printf("%lld")