USACO/Bronze
백준 15463 Blocked Billboard (USACO December 2017 Bronze 1번)
ssam..
2020. 3. 3. 01:40
문제 링크: 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
|