結果

問題 No.888 約数の総和
コンテスト
ユーザー vjudge1
提出日時 2024-09-26 00:10:44
言語 C++17
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 19 ms / 2,000 ms
コード長 494 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,002 ms
コンパイル使用メモリ 211,412 KB
実行使用メモリ 16,768 KB
最終ジャッジ日時 2026-07-05 19:07:17
合計ジャッジ時間 2,698 ms
ジャッジサーバーID
(参考情報)
judge3_1 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

void input(){
	#define taskname ""
	if(fopen(taskname ".inp", "r")){
		freopen(taskname ".inp", "r", stdin);
		freopen(taskname ".out","w",stdout);
	}
}
const int N = 1e6;
ll tonguoc(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;
}
ll n;
int main(){
	input();
	cin.tie(0)->sync_with_stdio(0);
	cin >> n;
	cout << tonguoc(n) << endl;
	return 0;
}
0