結果
問題 | No.888 約数の総和 |
ユーザー |
![]() |
提出日時 | 2019-09-20 21:26:42 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 13 ms / 2,000 ms |
コード長 | 514 bytes |
コンパイル時間 | 684 ms |
コンパイル使用メモリ | 67,576 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-14 16:17:31 |
合計ジャッジ時間 | 2,076 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 30 |
ソースコード
#include <iostream> #include <map> #define llint long long using namespace std; llint n; map<llint, llint> mp; int main(void) { ios::sync_with_stdio(0); cin.tie(0); cin >> n; for(int i = 2; i <= 1000000; i++){ while(n % i == 0){ mp[i]++; n /= i; } } if(n > 1) mp[n]++; llint ans = 1; for(auto it = mp.begin(); it != mp.end(); it++){ llint sum = 0, mul = 1; for(int i = 0; i <= it->second; i++){ sum += mul, mul *= it->first; } ans *= sum; } cout << ans << endl; return 0; }