1219. Snake again

单点时限: 2.0 sec

内存限制: 256 MB

Last time,we have done the snake matrix easy,now wo have to do it again,but it is also easy.

Last time,we had snake matrix like “snake matrix one”.Now we have it like picture two.What do we do?Like last time,output the snake matrix like “snake matrix two”? NO! That’s too bother.What we have to do is according to the input N, to find this number’s coordinate x,y,from the “snake matrix one”.finally output the number in “snake matrix two” whose coordinate is x and y.Is it easy?just do it.

输入格式

There are many tests.Each test have a number N in one line.N is not more than 5000.Please Process to end of file.

输出格式

For each case, output a number M in one line.

样例

Input
1
5
10
Output
1
5
7

63 人解决,74 人已尝试。

74 份提交通过,共有 150 份提交。

7.3 EMB 奖励。

创建: 13 年前.

修改: 2 年,9 月前.

最后提交: 11 月,1 周前.

来源: LSP

题目标签