Algorithm/백준
[BOJ] 1085번: 직사각형에서 탈출
suntall
2021. 2. 23. 01:21
#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 중에 최소 구함