Home [1일 1문제] 3월 21일 문제풀이
Post
Cancel

[1일 1문제] 3월 21일 문제풀이

✏️백준 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))
This post is licensed under CC BY 4.0 by the author.