백준1085: 직사각형에서 탈출
문제
https://www.acmicpc.net/problem/1085
문제 풀이
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
int y = sc.nextInt();
int w = sc.nextInt();
int h = sc.nextInt();
int xMin = Math.min(x, w - x);
int yMin = Math.min(y, h - y);
System.out.println(Math.min(xMin,yMin));
}
}
댓글남기기