/* -*- coding: utf-8 -*- * * 513.cc: No.513 宝探し2 - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int N = 100000; /* typedef */ /* global variables */ /* subroutines */ int reqres(int x, int y) { printf("%d %d\n", x, y); fflush(stdout); int r; scanf("%d", &r); return r; } /* main */ int main() { int r0 = reqres(0, 0); // x + y = r0 if (r0 == 0) return 0; int r1 = reqres(N, 0); // y = x - (N - r1) if (r1 == 0) return 0; // x + y = r0 ..(1) // y = x - (N - r1) -> x - y = (N - r1) ..(2) // (1)+(2) -> 2*x = r0 - r1 + N -> x = (r0 - r1 + N) /2 // (1)-(2) -> 2*y = r0 + r1 - N -> y = (r0 + r1 - N) /2 int x = (r0 - r1 + N) / 2, y = (r0 + r1 - N) / 2; printf("%d %d\n", x, y); fflush(stdout); return 0; }