문제 링크: https://www.acmicpc.net/problem/15463
15463번: Blocked Billboard
The first line of input contains four space-separated integers: $x_1$ $y_1$ $x_2$ $y_2$, where $(x_1, y_1)$ and $(x_2, y_2)$ are the coordinates of the lower-left and upper-right corners of the first billboard in Bessie's 2D field of view. The next line co
www.acmicpc.net
두개의 빌보드를 먼저 1로 채운다음, 트럭을 0을 덮어 씌운뒤, 1의 갯수를 세면 됨.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#include <bits/stdc++.h>
using namespace std;
int window[2001][2001];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
for(int t = 0; t < 3; t++) {
int a, b, c, d;
cin >> a >> b >> c >> d;
a += 1000, b += 1000, c += 1000, d += 1000;
for(int i = a; i < c; i++) for(int j = b; j < d; j++) {
if(t != 2) window[i][j] = 1;
else window[i][j] = 0;
}
}
int ans = 0;
for(int i = 0; i < 2001; i++) for(int j = 0; j < 2001; j++)
ans += window[i][j];
cout << ans << '\n';
return 0;
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
'USACO > Bronze' 카테고리의 다른 글
백준 15592 Blocked Billboard II (USACO January 2018 Bronze 1번) (0) | 2020.03.06 |
---|---|
백준 15464 The Bovine Shuffle (USACO December 2017 Bronze 2번) (0) | 2020.03.03 |
백준 14531 Bovine Genomics (USACO US Open 2017 Bronze 2번) (0) | 2020.03.01 |
백준 14530 The Lost Cow (USACO US Open 2017 Bronze 1번) (0) | 2020.03.01 |
백준 14469 소가 길을 건너간 이유 3 (USACO February 2017 Bronze 3번) (0) | 2020.03.01 |