Baekjoon 1085
직사각형에서 탈출


QUESTION ❔



CODE ⌨️

#include <iostream>

using namespace std;

int x, y, w, h;
int mindistance = 9999;

int order[4];

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

	cin >> x >> y >> w >> h;

	order[0] = x;
	order[1] = y;
	order[2] = w - x;
	order[3] = h - y;

	for (int i = 0; i < 4; i++)
	{
		if (order[i] < mindistance)
		{
			mindistance = order[i];
		}
	}

	cout << mindistance << "\n";

	return 0;
}



RESULT 💛



SIMPLE DISCUSSION ✏️

수학 관련 쉬운 문제였다.



SOURCE 💎

Baekjoon_Link 👈 Click here


*****
NOT A TALENT ❎ NOT GIVING UP ✅
CopyRight ⓒ 2022 DCherish All Rights Reserved.