✏️백준 1085번 : 나머지
나의 풀이
- Swift
1
2
3
4
5
let input = readLine()!.split(separator: " ").map{ Int(String($0))! }
let x = input[0]; let y = input[1]; let w = input[2]; let h = input[3]
let temp = [w-x, x, h-y, y]
print(temp.min()!)
- Python
1
2
3
4
5
6
7
import sys
input = sys.stdin.readline
x, y, w, h = map(int, input().strip().split())
temp = [w-x, x, h-y, y]
print(min(temp))