結果
| 問題 |
No.888 約数の総和
|
| コンテスト | |
| ユーザー |
stg1048599
|
| 提出日時 | 2019-09-24 14:11:47 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 913 bytes |
| コンパイル時間 | 1,336 ms |
| コンパイル使用メモリ | 167,524 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-19 05:07:12 |
| 合計ジャッジ時間 | 2,060 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 30 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
template <class T>ostream &operator<<(ostream &o,const vector<T>&v)
{o<<"{";for(int i=0;i<(int)v.size();i++)o<<(i>0?", ":"")<<v[i];o<<"}";return o;}
template <class T>ostream &operator<<(ostream &o,const pair<T, T>&p)
{o<<"("<<p.first<<", "<<p.second<<")";return o;}
map< int64_t, int > prime_factor(int64_t n) {
map< int64_t, int > ret;
for(int64_t i = 2; i * i <= n; i++) {
while(n % i == 0) {
ret[i]++;
n /= i;
}
}
if(n != 1) ret[n] = 1;
return ret;
}
int main(void){
lli n;
cin >> n;
auto m = prime_factor(n);
vector<lli> sumv;
for(auto i : m){
lli sum = 0;
for(lli j = 0; j < i.second+1; j++){
sum += pow(i.first, j);
}
sumv.push_back(sum);
}
lli res = 1;
for(auto i : sumv) res*=i;
cout << res << endl;
return 0;
}
stg1048599