結果
問題 | No.312 置換処理 |
ユーザー |
![]() |
提出日時 | 2019-03-09 16:48:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 548 bytes |
コンパイル時間 | 1,661 ms |
コンパイル使用メモリ | 169,884 KB |
実行使用メモリ | 814,184 KB |
最終ジャッジ日時 | 2024-06-23 15:13:50 |
合計ジャッジ時間 | 6,402 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 7 WA * 2 RE * 21 MLE * 1 -- * 14 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); long long n; cin >> n; vector<bool> F(n, true); F[0] = F[1] = false; for(long long i = 2; i <= (long long)sqrt(n); i++){ if(F[i]){ for(long long j = i * 2; j <= n; j += i){ F[j] = false; } } } for(long long i = 3; i <= n; i++){ if(F[i] and n % i == 0){ cout << i << endl; return 0; } } return 0; }