結果
| 問題 |
No.888 約数の総和
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-09-26 06:34:28 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 552 bytes |
| コンパイル時間 | 842 ms |
| コンパイル使用メモリ | 87,832 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-23 07:04:39 |
| 合計ジャッジ時間 | 1,978 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 WA * 3 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <map>
#include <math.h>
using namespace std;
typedef long long int ll;
template<typename T>
map<T,ll> factorize(T x){
map<T,ll> res;
for(ll i=2;i*i<=x;i++){
while(x%i==0){
x/=i;
res[i]++;
}
}
if(x!=1) res[x]++;
return res;
}
int main(){
ll n; cin >> n;
auto m=factorize(n);
ll ans=1;
for(auto x:m){
ans*=(ll)(pow(x.first,x.second+1)-1)/(x.first-1);
}
cout << ans << endl;
}