[백준] 1011번 : Fly me to the Alpha Centauri - Python(파이썬)

강재원·2022년 10월 25일
0

[코딩테스트] Python

목록 보기
148/200



https://www.acmicpc.net/problem/1011

n=int(input())
for i in range(n):
    x,y=map(int,input().split())
    k=1
    count=0

    while x<y:
        x+=k
        count+=1
        if x>=y: break
        y-=k
        count+=1
        k+=1
    print(count)
profile
개념정리 & 문법 정리 & 알고리즘 공부

0개의 댓글