結果

問題 No.888 約数の総和
ユーザー vjudge1
提出日時 2024-09-26 00:14:06
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 578 bytes
コンパイル時間 2,632 ms
コンパイル使用メモリ 242,632 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-09-26 00:14:22
合計ジャッジ時間 6,494 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 24 TLE * 1 -- * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 100000
ll sum(ll n){
    ll ans=1;
    for(int i=2;i*i<=n;i++){
            if (n%i==0) {
            ll sum=1;
            ll k=1;
            while (n%i==0) {
                n/=i;
                k*=i;
                sum+=k;
            }
            ans*=sum;
        }
    }
    if(n>1){
        ans*=(1+n);
    }
    return ans;
}
int main(){
	//freopen("stdin.inp","r",stdin);
	//freopen("stdout.out","w",stdout);

	//Your code here
    ll n;
    cin>>n;
    cout<<sum(n)<<endl;

	return 0;
}
0