1085 - 직사각형에서 탈출

solution

code

#include <iostream>
using namespace std;

int main()
{
    int x, y, w, h;
    cin >> x >> y >> w >> h;

    int width, hight;
    width = (x < w - x) ? x : w - x;
    hight = (y < h - y) ? y : h - y;
    int ans = (width < hight) ? width : hight;
    cout << ans << endl;

    return 0;
}

ref

1085번: 직사각형에서 탈출