結果
問題 |
No.136 Yet Another GCD Problem
|
ユーザー |
![]() |
提出日時 | 2020-11-25 04:39:25 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 619 bytes |
コンパイル時間 | 2,119 ms |
コンパイル使用メモリ | 199,256 KB |
最終ジャッジ日時 | 2025-01-16 05:36:02 |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 39 |
ソースコード
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> bool cmin(T &a, U b) { return a > b && (a = b, true); } template <typename T, typename U> bool cmax(T &a, U b) { return a < b && (a = b, true); } signed main() { cin.tie(nullptr); ios_base::sync_with_stdio(false); int N; cin >> N; auto div = [&](long n) { vector<long> ret; for (long i = 1; i * i <= n; i++) { if (n % i == 0) { ret.push_back(i); if (i * i != n) ret.push_back(n / i); } } sort(begin(ret), end(ret)); return ret; }; cout << *next(div(N).rbegin()) << "\n"; }