#include #include #include const int MOD = 1e9 + 7; // Function to compute (base^exp) % mod using binary exponentiation long long modExp(long long base, long long exp, long long mod) { long long result = 1; while (exp > 0) { if (exp % 2 == 1) { result = (result * base) % mod; } base = (base * base) % mod; exp /= 2; } return result; } int main() { // Step 1: Choose A and B (let's start with some reasonable values) int A = 100; int B = 100; // Output A and B std::cout << A << " " << B << std::endl; std::flush(std::cout); // Ensure the output is flushed // Step 2: Calculate Y = A^B % (10^9 + 7) long long Y = modExp(A, B, MOD); // Step 3: Read the value of K from the judge int K; std::cin >> K; // Step 4: Now we need to guess X'. Since we don't know X, let's make a reasonable guess // A simple first guess could be to assume X' = K for simplicity int X_prime_guess = K; // Output the guess for X' std::cout << X_prime_guess << std::endl; std::flush(std::cout); // Ensure the output is flushed // Step 5: Read the result from the judge (ret = 1 if correct, 0 if incorrect) int ret; std::cin >> ret; // If ret == 1, the guess is correct; otherwise, it's incorrect if (ret == 1) { std::cout << "Correct guess!" << std::endl; } else { std::cout << "Incorrect guess!" << std::endl; } return 0; }