結果
問題 |
No.312 置換処理
|
ユーザー |
![]() |
提出日時 | 2016-08-19 01:18:21 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 475 bytes |
コンパイル時間 | 939 ms |
コンパイル使用メモリ | 76,568 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-15 12:09:06 |
合計ジャッジ時間 | 2,247 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 45 |
ソースコード
#include <iostream> #include <fstream> #include <vector> #include <cstring> #include <string> #include <algorithm> #include <iomanip> using namespace std; typedef long long ll; ll f(ll n) { ll ret = n; for(ll i = 2; i * i <= n; i++) { if(n % i == 0) { if(i != 2) { ret = min(ret, i); } if(n / i != 2) { ret = min(ret, n / i); } } } return ret; } int main() { cin.tie(0); ios::sync_with_stdio(false); ll N; cin >> N; cout << f(N) << endl; }