結果

問題 No.888 約数の総和
ユーザー junsuijunsui
提出日時 2019-09-27 14:44:50
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 540 bytes
コンパイル時間 435 ms
コンパイル使用メモリ 63,092 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-24 16:03:21
合計ジャッジ時間 1,506 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 1 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 1 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 11 ms
4,348 KB
testcase_19 AC 8 ms
4,348 KB
testcase_20 AC 6 ms
4,348 KB
testcase_21 AC 10 ms
4,348 KB
testcase_22 AC 10 ms
4,348 KB
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 5 ms
4,348 KB
testcase_25 AC 6 ms
4,348 KB
testcase_26 AC 6 ms
4,348 KB
testcase_27 AC 8 ms
4,348 KB
testcase_28 AC 8 ms
4,348 KB
testcase_29 AC 9 ms
4,348 KB
testcase_30 AC 9 ms
4,348 KB
testcase_31 AC 9 ms
4,348 KB
testcase_32 AC 10 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cmath>
#include <iostream>

#define rep( i, n, m ) for (int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for (int i = ( n ); i < ( m ); i--)

typedef unsigned long long lint;

int main( void ){
	lint n;
	std::cin >> n;
	if (n == 1){
		printf( "1\n" );
		return 0;
	}
	lint sum = 1 + n;
	lint max = std::sqrt( n ) + 1;
	lint a;
	for(lint i = 2; i < max; i++){
		a = ( lint )( n / i );
		if (n - i * a == 0){
			sum += i + a;
			if (i == a)
				sum -= a;
		}
	}
	std::cout << sum << std::endl;
	return 0;
}
0