結果
| 問題 |
No.312 置換処理
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-28 18:34:55 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 36 ms / 2,000 ms |
| コード長 | 702 bytes |
| コンパイル時間 | 2,139 ms |
| コンパイル使用メモリ | 199,740 KB |
| 最終ジャッジ日時 | 2025-02-25 01:07:01 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 45 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, s, e) for (int i = (int)s; i < (int)e; i++)
#define all(a) (a).begin(), (a).end()
vector<ll> enum_divisors(ll n) {
vector<ll> res;
for (ll i = 1; i * i <= n; i++) {
if (n % i == 0) {
res.push_back(i);
if (n / i != i) res.push_back(n / i);
}
}
sort(res.begin(), res.end());
return res;
}
int main() {
cin.tie(nullptr);
ll N;
cin >> N;
vector<ll> divs = enum_divisors(N);
int i = 0;
while (true) {
if (divs[i] >= 3) {
cout << divs[i] << '\n';
return 0;
}
i++;
}
}