문제링크
https://www.acmicpc.net/problem/1085
나의코드
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.StringTokenizer;
public class Main{
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine(), " ");
int x = Integer.parseInt(st.nextToken());
int y = Integer.parseInt(st.nextToken());
int w = Integer.parseInt(st.nextToken());
int h = Integer.parseInt(st.nextToken());
int xw = Math.min(x, w-x);
int yh = Math.min(y, h-y);
System.out.print(Math.min(xw, yh));
}
}
'Baekjoon Online Judge' 카테고리의 다른 글
[BOJ] 백준 1181번: 단어 정렬 (Java) (0) | 2023.03.31 |
---|---|
[BOJ] 백준 1018번: 체스판 다시 칠하기 (Java) (0) | 2023.03.30 |
[BOJ] 백준 2920번: 음계 (Java) (0) | 2023.03.28 |
[BOJ] 백준 2742번: 기찍 N (Java) (0) | 2023.03.27 |
[BOJ] 백준 2741번: N 찍기 (Java) (0) | 2023.03.26 |
댓글