結果

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

ソースコード

diff #

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

ll sus(ll N) 
{
    ll sum = 0;
    for (ll i = 1; i * i <= N; ++i) 
	{
        if (N % i == 0) 
		{
            sum += i;
            if (i != N / i) 
                sum += N / i; 
        }
    }
    return sum;
}

signed main() 
{
	cin.tie(nullptr) -> sync_with_stdio(false);
	cout.tie(nullptr);

	#ifdef BACHS 	
		freopen("baitap.inp", "r", stdin);
		freopen("baitap.out", "w", stdout);
	#endif
	
    ll N;
    cin >> N;
    cout << sus(N) << endl; 
    return 0;
}
0