数字螺旋是一个无限大的网格,其左上角方格中的数字为 1。以下是螺旋的前五层:

你的任务是找出第 y 行第 x 列的数字。
第一行包含一个整数 t:测试数据组数。
接下来 t 行,每行包含两个整数 y 和 x。
对于每组测试数据,输出第 y 行第 x 列的数字。
3
2 3
1 1
4 2
8
1
15
1≤t≤105 1≤y,x≤109
By signing up a 战码少年-战码青少年编程(专业信息学奥赛编程训练) universal account, you can submit code and join discussions in all online judging services provided by us.