백준/C++

[C++] 백준 2563번 - 색종이

꿩꿩 2024. 9. 2. 23:54
728x90

 

문제 2563번

https://www.acmicpc.net/problem/2563

 

 

#include <iostream>
using namespace std;

int paper[100][100];

int main() {
	int n, x, y, cnt = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> x >> y;
		for (int j = 0; j < 10; j++) {
			for (int w = 0; w < 10; w++) {
				if (!paper[j + y][w + x]) {
					paper[j + y][w + x] = 1;
					cnt++;
				}
				else {
					continue;
				}
			}
		}
	}
	cout << cnt;
	return 0;
}

 

 

728x90