๋ฌธ์
https://www.acmicpc.net/problem/1011
ํ์ด
# ๋ฐฑ์ค 1011๋ฒ ๋ฌธ์ - Fly me to the Alpha Centauri
t = int(input())
for _ in range(t):
x, y = map(int, input().split())
distance = y - x
cnt = 0
move = 1
move_plus = 0 # ์ด๋ํ ๊ฑฐ๋ฆฌ์ ํฉ
while move_plus < distance:
cnt += 1
move_plus += move
if cnt % 2 == 0:
move += 1
print(cnt)
'๐๏ธ Algorithm > ๐ฉ ๋ฐฑ์ค' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
๐ฉ [๋ฐฑ์ค] [Python] [Gold5] 1107๋ฒ_๋ฆฌ๋ชจ์ปจ (1) | 2023.04.21 |
---|---|
๐ฉ [๋ฐฑ์ค] [Python] [Gold5] 9251๋ฒ_LCS (0) | 2023.04.21 |
๐ฉ [๋ฐฑ์ค] [Python] [Gold5] 2447๋ฒ_๋ณ ์ฐ๊ธฐ - 10 (0) | 2023.04.21 |
๐ฉ [๋ฐฑ์ค] [Python] [Gold4] 7662๋ฒ_์ด์ค ์ฐ์ ์์ ํ (0) | 2023.04.20 |
๐ฉ [๋ฐฑ์ค] [Python] [Gold3] 1520๋ฒ_๋ด๋ฆฌ๋ง ๊ธธ (0) | 2023.04.19 |