문제 링크 : https://www.acmicpc.net/problem/1085
1085번: 직사각형에서 탈출
첫째 줄에 x y w h가 주어진다. w와 h는 1,000보다 작거나 같은 자연수이고, x는 1보다 크거나 같고, w-1보다 작거나 같은 자연수이고, y는 1보다 크거나 같고, h-1보다 작거나 같은 자연수이다.
www.acmicpc.net
#include <iostream>
#include <algorithm>
#define n_ 1005
using namespace std;
int n, m;
int arr[n_];
char str[n_];
int main(void) {
int x, y, w, h;
cin >> x >> y >> w >> h;
int res = min(x, y);
res = min(res, min(w - x, h - y));
cout << res << endl;
return 0;
}
'알고리즘 > PS' 카테고리의 다른 글
[백준 9012] 괄호 (0) | 2020.08.14 |
---|---|
[백준 17608] 막대기 (0) | 2020.08.12 |
[백준 17419] 비트가 넘쳐흘러 (0) | 2020.08.03 |
[백준 2193] 이친수 (0) | 2020.08.01 |
[백준 14697] 방 배정하기 (0) | 2020.08.01 |