結果

問題 No.888 約数の総和
ユーザー vjudge1
提出日時 2024-09-25 23:48:48
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 337 bytes
コンパイル時間 1,831 ms
コンパイル使用メモリ 190,356 KB
最終ジャッジ日時 2025-02-24 12:39:39
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using ll = long long;
using namespace std;

ll tinh(ll n)
{
	ll ok=1, i=2;
	while(i*i<=n)
	{
		ll s=i;
		while(n%i==0) {n/=i; s*=i;}
		ok = ok*(s-1)/(i-1);
        ++i;
	}
	if(n>1) ok = ok*(n*n-1)/(n-1);
	return ok;
}

ll n;
int main()
{
	cin.tie(0)->sync_with_stdio(0);
	cin >> n;
	cout << tinh(n);
	return 0;
}
0