본문 바로가기

Algorithm

C++(씨쁠쁠)(cplusplus)-백준(baekjoon)(BaekJoon)코딩 2563번:색종이 답

반응형
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
using namespace std;
int a[101][101],n,x,y,ans;
int main() {
    cin >> n;
    while (n--)
    {
        cin >> x >> y;
        for (int j = 91 - y; j <= 100 - y; j++)
            for (int i = x+1; i <= x + 10; i++)
                a[j][i] = 1;
    }
    for (int i = 1; i <= 100; i++)
        for (int j = 1; j <= 100; j++)
            if (a[i][j] == 1)
                ans++;
    cout << ans << '\n';
}
cs