#include <stdio.h>
int main(void)
{
int i, x, y, n, steps, r, add, d;
scanf("%d", &n);
while (n--)
{
scanf("%d%d", &x, &y);
d = y-x;
if (d)
{
steps = 1;
r = 0;
add = 0;
do {
if (steps%2)
add++;
r = r + add;
steps++;
} while (r < d);
printf("%d\n", steps-1);
}
else
printf("0\n");
}
return 0;
}
沒有留言:
張貼留言