[BOJ] 2563 색종이

Time Lapse :15min 3sec

2563.c

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <stdio.h>
int p[100][100];
int main(int argc, char** argv) {
int N, answer = 0, x, y;
scanf("%d", &N);
for (int i = 0; i < N; i++) {
scanf("%d %d", &x, &y);
for (int _x = x; _x < x + 10; _x++)
for (int _y = y; _y < y + 10; _y++)
p[_y][_x] = 1;
}
for (int i = 0; i < 100; i++)
for (int j = 0; j < 100; j++)
if (p[i][j]) ++answer;
printf("%d", answer);
}
Author: Song Hayoung
Link: https://songhayoung.github.io/2020/07/30/PS/BOJ/2563/
Copyright Notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless stating additionally.