|
|||
Ant on a ChessboardOne day, an ant called Alice came to an M×M chessboard. She wanted to go around all the squares. So she began to walk along the chessboard according to this way (you can assume that her speed is one square per second): At the first second, Alice was standing at (1,1). Firstly, she went up a square, then a square to the right, then a square downward. After that, she went a square to the right, then two squares upward, and then two squares to the left… In a word, the path was like a snake. For example, her first 25 seconds went like this (the number in each square stands for the time when she went into that square): At the 8th second, she was at (2,3), and at the 20th second, she was at (5,4). Your task is to decide where she was at a given time (you can assume that M is large enough). Input SpecificationThe input will contain several lines, and each line contains a number N (1 ≤ N ≤ 2⋅109) which stands for the time. The input will be terminated with a line that contains a number 0. Output SpecificationFor each input situation, you should print a line with two numbers (x, y), the column and the row number, with exactly one space between them. Sample Input
Output for Sample Input
|
|||
University of Debrecen; Faculty of Informatics; v. 03/01/2019 |