4301124 2006-02-01 18:55:01 Accepted 0.010 Minimum 28565 C++ 10182 - Bee Maja
~cpp #include <iostream> using namespace std; void process(int num) { int de_x[6] = {0,-1,-1,0,1,1}; int de_y[6] = {-1,0,1,1,0,-1}; int count = 0, temp = 6, x, y, i; num -= 1; while(num > 0) { num -= temp; temp += 6; count++; } x = count; y = 0; for(i = 0; num != 0; i++) { if(-1*num < count) temp = -1*num; else temp = count; x += de_x[i]*temp; y += de_y[i]*temp; num += temp; } cout << x << " " << y << endl; } int main() { int num; while(cin >> num) process(num); return 0; }