結果
問題 |
No.888 約数の総和
|
ユーザー |
![]() |
提出日時 | 2020-07-24 15:52:08 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 5 ms / 2,000 ms |
コード長 | 567 bytes |
コンパイル時間 | 1,735 ms |
コンパイル使用メモリ | 174,532 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-25 06:55:56 |
合計ジャッジ時間 | 2,881 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include <bits/stdc++.h> using ll = long long; using namespace std; int main() { ll n; cin >> n; if (n == 1) { cout << "1\n"; return 0; } ll t{ n }, pf{ 2 }; map<ll, int> m; while (t >= pf * pf) { if (!(t % pf)) { ++m[pf]; t /= pf; } else { ++pf; } } ++m[t]; ll res{ 1 }; for (const auto& im : m) res *= (pow(im.first, im.second + 1) - 1) / (im.first - 1); cout << res << "\n"; return 0; }