結果
| 問題 |
No.8093 Please GCD
|
| コンテスト | |
| ユーザー |
platinum
|
| 提出日時 | 2022-04-01 23:06:25 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 817 bytes |
| コンパイル時間 | 1,967 ms |
| コンパイル使用メモリ | 199,048 KB |
| 最終ジャッジ日時 | 2025-01-28 14:22:22 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 WA * 19 MLE * 1 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin >> N;
vector<int> p;
for(int i = 2; i <= N; i++){
int siz = p.size();
bool is_prime = true;
for(int j = 0; j < siz; j++){
if(i % p[j] == 0) is_prime = false;
}
if(is_prime) p.emplace_back(i);
}
int p_siz = p.size();
random_device rnd;
mt19937 mt(rnd());
uniform_int_distribution<> prime(0, p_siz - 1);
int ans = 1;
int turn = 0;
while(turn < 600){
int d = prime(mt);
if(ans * p[d] > N) continue;
turn++;
cout << "? " << ans * p[d] << endl;
int g;
cin >> g;
ans = g;
if(ans > N / 2){
cout << "! " << ans << endl;
return 0;
}
}
return 0;
}
platinum