페이지

1011번: Fly me to the Alpha Centauri

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


#include<stdio.h>
int t, x, y;
int main() {
    scanf("%d", &t);
    while (t--) {
        scanf("%d %d", &x, &y);
        for (int i = 1;; i++)
            if (y - x <= (long long)(i / 2)*(i / 2 + 1) + i % 2 * (i / 2 + 1)) { printf("%d\n", i); break; }
    }
    return 0;
}

댓글 없음 :

댓글 쓰기