結果
問題 |
No.888 約数の総和
|
ユーザー |
|
提出日時 | 2019-09-20 21:34:42 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 598 bytes |
コンパイル時間 | 1,713 ms |
コンパイル使用メモリ | 171,604 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-14 16:41:11 |
合計ジャッジ時間 | 2,767 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 WA * 3 |
ソースコード
#include <bits/stdc++.h> using namespace std; map<int64_t, int64_t> prime_division(int64_t n){ map<int64_t, int64_t> ret; for(int64_t i=2; i*i<=n; i++){ while(n % i == 0){ n /= i; ret[i]++; } } if(n > 1) ret[n] = 1; return ret; } int main() { int64_t N; cin >> N; auto ps = prime_division(N); int64_t ans = 1; for(auto& pr : ps){ int64_t p = pr.first, num = pr.second; int64_t P = 1; for(int i=0; i<=num; i++) P *= p; ans *= (P-1)/(p-1); } cout << ans << endl; return 0; }