#include <iostream>
using namespace std;
int main() {
int x, y, w, h;
cin >> x >> y >> w >> h;
x = x > w-x ? w-x : x;
//cout << "x=" << x << endl;
y = y > h-y ? h-y : y;
//cout << "y=" << y << endl;
int answer = 0;
answer = x > y ? y : x;
cout << answer;
}
그냥 x, y, w-x, h-y 중에 최소 구함
'Algorithm > 백준' 카테고리의 다른 글
[BOJ] 4153번: 직사각형 C++ (0) | 2021.02.28 |
---|---|
[BOJ]1193번: 분수찾기 (0) | 2021.02.15 |
[BOJ] 2775번: 부녀회장이 될테야 (0) | 2021.02.14 |