結果
| 問題 |
No.888 約数の総和
|
| コンテスト | |
| ユーザー |
cureskol
|
| 提出日時 | 2020-04-15 16:50:00 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 493 bytes |
| コンパイル時間 | 1,965 ms |
| コンパイル使用メモリ | 173,960 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-10-01 18:49:48 |
| 合計ジャッジ時間 | 2,761 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 WA * 3 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int long long
int pw(int n,int k){
assert(k>=0);
int res=1;
while(k){
if(k&1)res*=n;
n*=n;
k>>=1;
}
return res;
}
signed main(){
int n;cin>>n;
map<int,int> m;
for(int i=2;i*i<=n;i++){
if(n%i)continue;
int cnt=0;
while(n%i==0){
cnt++;
n/=i;
}
m[i]=cnt;
}
if(n>1)m[n]++;
int ans=1;
for(auto p:m){
ans*=(pw(p.first,p.second+1)-1)/(p.first-1);
}
cout<<ans<<endl;
}
cureskol