結果
問題 |
No.8093 Please GCD
|
ユーザー |
![]() |
提出日時 | 2022-04-01 22:25:49 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 943 bytes |
コンパイル時間 | 1,651 ms |
コンパイル使用メモリ | 168,028 KB |
実行使用メモリ | 25,460 KB |
平均クエリ数 | 206.73 |
最終ジャッジ日時 | 2024-11-20 10:03:34 |
合計ジャッジ時間 | 5,994 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 WA * 5 |
ソースコード
#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(1){ out *= now; if(out*ans>n) break; cout << "? " << out << '\n' << flush; cin >> res; if(res==pre || res<0) break; pre = res; } ans *= pre; } cout << "! " << ans << '\n' << flush; return 0; }