結果
問題 |
No.3115 One Power One Kill
|
ユーザー |
|
提出日時 | 2025-04-19 11:53:45 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,518 bytes |
コンパイル時間 | 1,055 ms |
コンパイル使用メモリ | 86,216 KB |
実行使用メモリ | 26,252 KB |
平均クエリ数 | 3.00 |
最終ジャッジ日時 | 2025-04-19 11:53:51 |
合計ジャッジ時間 | 4,467 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 20 |
ソースコード
#include <iostream> #include <cmath> #include <algorithm> 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; }