// Bee Maja (BEE Maja) // PC/Ultraviolet IDs: 111204/10182, popularity: B, success rate: high level: 2 // verdict: accepted // submission date: 2011-11-01 // UV Run Time: 0.012 S // copyright (c) 2011, Qiu. Metaphysis # Yeah dot net // [solution] // simulate the movement of bee Willi and generate coordinates based on the laws of the two coordinate systems. The rule is: the number on each side is the same as the number on each side. Six sides of the 12 numbers, such as 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, and 9. The lower left side is composed of 9, 10, and 11, and the abscissa is reduced by one in turn, the ordinate coordinates remain unchanged. For other edges, there is a similar law. The exception is that the lower right edge has only 8 to 9 numbers, and the number that makes up the edge needs to be specially processed. Select 1, 2, 9, // 22,... for the starting beehive number during processing. The difference between adjacent numbers forms an equal difference sequence with an initial item of 1 and a difference of 6. Due to the initial processing of the beehive number relationship, you need to relax the number of the beehive coordinates to be calculated. Otherwise, some beehive numbers cannot be calculated due to the circular relationship. # Include <iostream> # include <set> using namespace STD; # define maxn 100200int offset [5] [2] = {-1, 0}, {0, -1 },{ 1,-1 },{ 1, 0 },{ 0, 1 }}; pair <int, int> Maja [maxn + 2000]; int main (int ac, char * AV []) {for (INT I = 1, j = 1, K = 0; I <maxn; I ++ = J, J + = 6, K ++) {Maja [I] = make_pair (0, k); For (INT m = 0; m <K; m ++) maja [I-m] = make_pair (M, K-m); int current = I; for (INT m = 0; m <5; m ++) for (INT n = 0; n <K; n ++) {int x = Maja [current]. first + offset [m] [0]; int y = Maja [current]. second + offset [m] [1]; Maja [current + 1] = make_pair (x, y); current ++ ;}} int Willi; while (CIN> Willi) cout <Maja [Willi]. first <"" <Maja [Willi]. second <Endl; return 0 ;}