結果

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

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll a;
ll s = 1;
int main() {
    cin >> a;
    ll n = a;
    s += a;
    for(int i = 2; i * i <= a; i++) {
        ll c = 0;
        while(a % i == 0) {
            a /= i;
            c++;
        }
        s += (c * i);
    }
    if(a > 1 && a != n) {
        s += a;
    }
    cout << s;
    return 0;
}
0