結果
| 問題 | No.8093 Please GCD |
| コンテスト | |
| ユーザー |
houren
|
| 提出日時 | 2022-04-01 22:21:01 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 939 bytes |
| 記録 | |
| コンパイル時間 | 1,747 ms |
| コンパイル使用メモリ | 169,464 KB |
| 実行使用メモリ | 25,476 KB |
| 平均クエリ数 | 198.93 |
| 最終ジャッジ日時 | 2024-11-20 09:56:29 |
| 合計ジャッジ時間 | 6,042 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 23 WA * 7 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmin(T&a, const T&b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool chmax(T&a, const T&b){if(a<b){a=b;return 1;}return 0;}
int main(){
cin.tie(nullptr);
ios::sync_with_stdio(false);
ll n, res = 1, pre, now = 2, out, ans = 1;
cin >> n;
vector<bool> pn(n+100,true);
while(res>=0){
out = pre = 1;
while(!pn[now]) now++;
if(now>n) break;
for(int i=now;i<=n;i+=now) pn[i] = false;
while(res>=0){
out *= now;
if(out*ans>n) break;
cout << "? " << out << '\n' << flush;
cin >> res;
if(res==pre) break;
pre = res;
}
ans *= pre;
}
cout << "! " << ans << '\n' << flush;
return 0;
}
houren