Algorithm

BOJ 1085 직사각형에서 탈출 c++

최강훈 2020. 11. 7. 10:02

BOJ 1085 직사각형에서 탈출 cpp

백준 1085 직사각형에서 탈출 c++


#include <bits/stdc++.h>
using namespace std;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    int west, east, north, south;
    int x, y, w, h;
    cin >> x >> y >> w >> h;

    west = x;
    east = w - x;
    north = h - y;
    south = y;
    int arr[4] = {west, east, north, south};
    sort(arr, arr+4);
    cout << arr[0];
}