问题1320--Roxy Tree

1320: Roxy Tree

[命题人 : ]
时间限制 : 1.000 sec  内存限制 : 128 MB

提交

题目描述

Roxy M. Greyrat is your data structures and algorithms teacher. Recently, she created a new data structure called Roxy tree.
Roxy Tree has one root node, and the root node has 2 children. So there are 2 nodes on the second layer.
But then the amount of the children of the nodes on the second layer is 3, and then the amount of the children of the nodes on the third layer is back to 2, do 2-3-loop, and so on. 
Formally, the amount of the children of the nodes on the i-th layer is 2 if i is odd, and is 3 if i is even.
For example, a Roxy tree (or maybe called binary-ternary tree?):

You can see some numbers near the nodes, they are indexes of the nodes.
The Problem is, I will give you some of indexes of the nodes, you should tell me they are which one on which layer.

Since this is the first problem, I will give you a friendly tip. This problem uses ACM input-output formats. You can get an aid from this page: 帮助 - AHUCM Online JudgeGood luck!

输入

Several lines of indexes Ii.

输出

Corresponding i and j for each line of input. They are means that this node is the j-th one on the i-th layer. i and j are indexed from 1.

样例输入 Copy

0
2
6
20

样例输出 Copy

1 1
2 2
3 4
4 12

提示

Values' range:
0 <= Ii <= 1017

来源/分类