結果
問題 |
No.8093 Please GCD
|
ユーザー |
![]() |
提出日時 | 2022-04-01 22:16:35 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 917 bytes |
コンパイル時間 | 1,918 ms |
コンパイル使用メモリ | 168,668 KB |
実行使用メモリ | 25,476 KB |
平均クエリ数 | 505.93 |
最終ジャッジ日時 | 2024-11-20 09:47:37 |
合計ジャッジ時間 | 8,524 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 6 WA * 24 |
ソースコード
#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>n) break; cout << "? " << out << endl; cin >> res; if(res==pre) break; pre = res; } ans *= pre; } cout << "! " << ans << endl; return 0; }