結果
問題 |
No.312 置換処理
|
ユーザー |
|
提出日時 | 2018-09-08 13:00:40 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 500 bytes |
コンパイル時間 | 633 ms |
コンパイル使用メモリ | 60,020 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-15 12:21:58 |
合計ジャッジ時間 | 1,652 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 45 |
ソースコード
#include <iostream> #include <cmath> typedef long long dlong; int main(int argc, char const* argv[]) { dlong n; std::cin >> n; if (n % 4 == 0 && n % 3 != 0) { std::cout << 4 << std::endl; return 0; } dlong ans = n; dlong imax = sqrt(n); for (dlong i = 3; i <= imax; i+=2) { if (n % i == 0) { ans = i; break; } } if (ans == n && n % 2 == 0) ans /= 2; std::cout << ans << std::endl; return 0; }