IT 정보/알고리즘(백준, BOJ)
[백준-BOJ] 1085
Dalyoung
2017. 1. 14. 10:01
반응형
https://www.acmicpc.net/problem/1085
import java.io.BufferedReader; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) throws IOException { Main m = new Main(); m.doit(); } public void doit() throws IOException{ //System.setIn(new FileInputStream("input.txt")); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String [] input = br.readLine().split(" "); int x = Integer.parseInt(input[0]); int y = Integer.parseInt(input[1]); int w = Integer.parseInt(input[2]); int h = Integer.parseInt(input[3]); int minX = Math.min(x, w - x); int minY = Math.min(y, h - y); System.out.println(Math.min(minX, minY)); br.close(); } }
반응형