303163: CF615E. Hexagons

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Hexagons

题意翻译

一个坐标系上铺满了六边形,每一个六边形都有一个坐标。如英文题面的左图,绿色箭头是坐标轴的正方向。有一个人现在从 $(0,0)$ 为起点按照红色箭头的顺序走了 $n$ 个六边形(起点算第 $0$ 个六边形),问他最后停在哪个六边形上,输出这个六边形的坐标。 $0\le n\le 10^{18}$

题目描述

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: ![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF615E/7260dcf1ee40fd1194e895987c69d1d7c92f50b5.png)![](https://cdn.luogu.com.cn/upload/vjudge_pic/CF615E/91f722e14e3f2875c1cec2e05543b6613c3b2f75.png) 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

Input

题意翻译

一个坐标系上铺满了六边形,每一个六边形都有一个坐标。如英文题面的左图,绿色箭头是坐标轴的正方向。有一个人现在从 $(0,0)$ 为起点按照红色箭头的顺序走了 $n$ 个六边形(起点算第 $0$ 个六边形),问他最后停在哪个六边形上,输出这个六边形的坐标。 $0\le n\le 10^{18}$

加入题单

上一题 下一题 算法标签: