Bee Maja
Time limit1sMemory limit128 MB
Convert a spiral hex-grid cell number into hexagonal axial coordinates using the orientation shown in the sample.
- Level
Medium5 of 10
- Topics
- Math, Implementation, Simulation, Geometry
- Solved
- No attempts yet
Problem
Maja is a worker bee who lives in a hive together with thousands of other bees. The hive is a honeycomb: a grid of hexagonal cells in which honey is stored.
Maja wants to meet Willi, a male drone, but the two of them describe the hive with different coordinate systems.
Given a cell number in Willi's system, output that cell's coordinates in Maja's system. The exact orientation of the spiral is the one shown by the sample.
Input
The input contains one or more integers, each of them one of Willi's cell numbers. Each number is given on its own line. Every cell number is less than .
Output
For each of Willi's numbers, output the coordinates of that cell in Maja's system as two integers x y separated by a single space, one pair per line, in the same order as the input.