結果
問題 | No.312 置換処理 |
ユーザー |
|
提出日時 | 2015-12-05 00:48:48 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 449 bytes |
コンパイル時間 | 606 ms |
コンパイル使用メモリ | 60,124 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-15 11:47:21 |
合計ジャッジ時間 | 2,060 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 45 |
ソースコード
#include <iostream>#include <vector>using namespace std;typedef long long ll;ll solve(ll N){vector<ll> divisors;for(ll d=1;d*d<=N;d++){if(N % d == 0){divisors.push_back(d);if(N / d != d){divisors.push_back(N / d);}}}ll res = N;for(ll d : divisors){if(d > 2){res = min(res, d);}}return res;}int main(){ll N;cin >> N;cout << solve(N) << endl;return 0;}