[백준 1085] 직사각형 탈출
2023. 4. 1. 22:45ㆍ자료구조 및 알고리즘/백준
728x90
쉬운 구현
#include <iostream>
using namespace std;
int main(void){
ios::sync_with_stdio(0);
cin.tie(0);
int x,y,w,h;
cin>>x>>y>>w>>h;
int arr[4];
arr[0]=x;
arr[1]=y;
arr[2]=w-x;
arr[3]=h-y;
int min=arr[0];
for(int i=0; i<4; i++){
if(min>arr[i])
min=arr[i];
}
cout<<min;
}
728x90
'자료구조 및 알고리즘 > 백준' 카테고리의 다른 글
[백준 1978] 소수 찾기 (0) | 2023.04.01 |
---|---|
[백준 11050]이항 계수 1 (0) | 2023.04.01 |
[백준 24444] 알고리즘 수업 - 너비 우선 탐색 1 (0) | 2023.03.31 |
[백준 1926] 그림 문제 복습 (실수 최종 수정) (0) | 2023.03.31 |
[백준 24480] 알고리즘 수업 - 깊이 우선 탐색 2 (0) | 2023.03.28 |