結果

問題 No.312 置換処理
ユーザー kyo1
提出日時 2020-06-21 02:52:40
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 14 ms / 2,000 ms
コード長 411 bytes
コンパイル時間 2,120 ms
コンパイル使用メモリ 199,588 KB
最終ジャッジ日時 2025-01-11 08:52:29
ジャッジサーバーID
(参考情報)
judge1 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 45
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int64_t N;
  cin >> N;
  vector<int64_t> cands = {N};
  for (int64_t i = 2; i * i < N + 1; i++) {
    if (N % i == 0) {
      if (i != 2) cands.emplace_back(i);
      if (N / i != 2) cands.emplace_back(N / i);
    }
  }
  sort(cands.begin(), cands.end());
  cout << cands.front() << '\n';
  return 0;
}
0