8000 Update 1780.cpp · twinkite/basic-algo-lecture@fbaec2d · GitHub
[go: up one dir, main page]

Skip to content

Commit fbaec2d

Browse files
Update 1780.cpp
1 parent a87e2c7 commit fbaec2d

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

0x0B/solutions/1780.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,34 @@ using namespace std;
66

77
int N;
88
int paper[2200][2200];
9-
int cnt[3]; //-1, 0, 1로 채워진 종이 갯수
9+
int cnt[3]; //-1, 0, 1로 채워진 종이 갯수
1010

11-
//해당 종이 내부에 같은 숫자로만 채워졌는지 확인하는 함수
11+
//해당 종이 내부에 같은 숫자로만 채워졌는지 확인하는 함수
1212
bool check(int x, int y, int n) {
1313
for (int i = x; i < x + n; i++)
14-
for (int j = y; j < y + n; j++)
15-
if (paper[x][y] != paper[i][j])
16-
return false;
14+
for (int j = y; j < y + n; j++)
15+
if (paper[x][y] != paper[i][j])
16+
return false;
1717
return true;
1818
}
1919
void solve(int x, int y, int z)
2020
{
2121
if (check(x, y, z)) {
22-
cnt[paper[x][y] + 1] += 1;
23-
return;
24-
}
22+
cnt[paper[x][y] + 1] += 1;
23+
return;
24+
}
2525
int n = z / 3;
2626
for (int i = 0; i < 3; i++)
27-
for (int j = 0; j < 3; j++)
28-
solve(x + i * n, y + j * n, n);
27+
for (int j = 0; j < 3; j++)
28+
solve(x + i * n, y + j * n, n);
2929
}
3030
int main(void) {
3131
ios::sync_with_stdio(0);
3232
cin.tie(0);
3333
cin >> N;
3434
for (int i = 0; i < N; i++)
35-
for (int j = 0; j < N; j++)
36-
cin >> paper[i][j];
35+
for (int j = 0; j < N; j++)
36+
cin >> paper[i][j];
3737
solve(0, 0, N);
3838
for (int i = 0; i < 3; i++) cout << cnt[i] << "\n";
39-
}
39+
}

0 commit comments

Comments
 (0)
0