<PREV Problem:
NEXT>
Solved by 1716 users: ...
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 
 < 

Strange Tower

Time limit = 5 second(s)

The strange tower have infinite number of stores and rooms. The first store has one room, next two stores have two rooms each, next three stores have three rooms each, ...

The tower is provided with lift. But inhabitants enconter the following problem: how to get store number and room position on the store given room number?

Input Room number N. 1 ≤ N ≤ 2 000 000 000.

Output Two integers delimited with space: store number and order number from the left.

Input#1
1
Output#1
1 1
Input#2
5
Output#2
3 2
Input#3
8
Output#3
4 3

Author:
Voroztsov Artem

<PREV | Problem set | Search related messages | NEXT>


© acm.mipt DevGroup
The page was generated in 220ms

SW soft NIX
ID = 54.144.21.195