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