== 소감 == || 2006-02-01 Accepted 0.000 Minimum || 어느정도의 규칙(?)만 파악한다면 O(1)만에 구할 수 있다. == 코드 == {{{~cpp // 10161 - Ant on a Chessboard #include using namespace std; #include static int t; inline void show(const int i, const int j) { cout << i << ' ' << j << endl; } void show_typeA(const int x, const int y) { if (t - x * x <= x) show(t - x * x, x + 1); else show(y, y * y - t + 1); } void show_typeB(const int y, const int x) { if (x * x - t <= y) show(x * x - t + 1, y + 1); else show(y + 1, t - y * y); } void show_typeS(const int x) { if (x & 0x1) show(1, x); else show(x, 1); } void process() { int x = floor(sqrt(t)); if (x == sqrt(t)) show_typeS(x); else if (x & 0x1) show_typeA(x, x + 1); else show_typeB(x, x + 1); } int main() { while (cin >> t && t != 0) process(); return 0; } }}} ---- [AntOnAChessboard]