1234567891011121314151617181920212223 |
- #include <iostream>
- using namespace std;
- int main() {
- int T;
- while (cin >> T) {
- for (int i = 0; i < T; i++) {
- int N, M;
- cin >> N >> M;
- int grid = 0;
- int count = 0;
- for (int j = 0; j < N * M; j++) {
- cin >> grid;
- if (grid == 1) {
- count++;
- }
- }
- cout << count << endl;
- }
- }
- return 0;
- }
|