본문 바로가기
카테고리 없음

[백준 / c++] 1085번: 직사각형에서 탈출

by pimyu1 2024. 7. 29.
반응형

https://www.acmicpc.net/problem/1085

 

 

 

-문제-

 


 

-정답-

 

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
  int x, y, w, h;
  cin >> x >> y >> w >> h;
   vector<int> arr;
   arr.push_back(x - 0);
   arr.push_back(w - x);
   arr.push_back(y - 0);
   arr.push_back(h - y);

   sort(arr.begin(), arr.end());

   cout << arr[0];


  return 0;
}
반응형