📌문제
https://www.acmicpc.net/problem/9455
🎖️난이도
✔️풀이
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <math.h>
#include <tuple>
#include <typeinfo> // operator typeid
using namespace std;
int main(void) {
int T(0);
int m, n;
int map[100][100];
cin >> T;
for (int i = 0; i < T; i++) {
cin >> m >> n;
map[100][100] = { -1, };
for (int j = 0; j < m; j++) {
for (int k = 0; k < n; k++) {
cin >> map[j][k];
}
}
int answer = 0;
for (int col = 0; col < n; col++) {
int cnt = m - 1;
for (int row = m - 1; row >= 0; row--) {
if (map[row][col]) {
answer += cnt - row;
cnt--;
}
}
}
cout << answer << endl;
}
return 0;
}
'[ 알고리즘 ] > Implementation' 카테고리의 다른 글
[백준] 2438. 별 찍기 - 1 (0) | 2022.06.30 |
---|---|
[CodeUp] 6098. 성실한 개미 (0) | 2022.06.29 |
[CodeUp] 6096. 바둑알 십자 뒤집기 (0) | 2022.06.29 |
[백준] 14954. Happy Number (0) | 2022.06.29 |
[백준] 13567. 로봇 (0) | 2022.06.29 |