测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A10258. Hexagons

编程题 普及/提高-

题目描述

Ayrat is looking for the perfect code. He decided to start his search from an infinite field tiled by hexagons. For convenience the coordinate system is introduced, take a look at the picture to see how the coordinates of hexagon are defined:

![](/uploads/luogu/CF615E/7260dcf1ee40fd1194e895987c69d1d7c92f50b5_3456d4b43e89.png)![](/uploads/acgo/image/b43f30ce11ccbd7b_22b0b481c3d2.jpeg) Ayrat is searching through the field. He started at point $(0,0)$ and is moving along the spiral (see second picture). Sometimes he forgets where he is now. Help Ayrat determine his location after $n$ moves.

输入格式

The only line of the input contains integer $n$ ( $0<=n<=10^{18}$ ) — the number of Ayrat's moves.

输出格式

Print two integers $x$ and $y$ — current coordinates of Ayrat coordinates.

输入输出样例

输入 #1
3
输出 #1
-2 0
输入 #2
7
输出 #2
3 2
上一题 去做题 下一题