๐๏ธ Algorithm/๐ฉ ๋ฐฑ์ค
๐ฉ [๋ฐฑ์ค] [Python] [Gold5] 1011๋ฒ_Fly me to the Alpha Centauri
Dbswnstjd
2023. 4. 21. 11:26
๋ฌธ์
https://www.acmicpc.net/problem/1011
1011๋ฒ: Fly me to the Alpha Centauri
์ฐํ์ด๋ ์ด๋ฆฐ ์์ , ์ง๊ตฌ ์ธ์ ๋ค๋ฅธ ํ์ฑ์์๋ ์ธ๋ฅ๋ค์ด ์ด์๊ฐ ์ ์๋ ๋ฏธ๋๊ฐ ์ค๋ฆฌ๋ผ ๋ฏฟ์๋ค. ๊ทธ๋ฆฌ๊ณ ๊ทธ๊ฐ ์ง๊ตฌ๋ผ๋ ์ธ์์ ๋ฐ์ ๋ด๋ ค ๋์ ์ง 23๋ ์ด ์ง๋ ์ง๊ธ, ์ธ๊ณ ์ต์ฐ์ ASNA ์ฐ์ฃผ ๋นํ
www.acmicpc.net
ํ์ด
# ๋ฐฑ์ค 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)