結果

問題 No.888 約数の総和
ユーザー htensaihtensai
提出日時 2019-11-11 12:30:29
言語 Java21
(openjdk 21)
結果
AC  
実行時間 138 ms / 2,000 ms
コード長 382 bytes
コンパイル時間 1,903 ms
コンパイル使用メモリ 71,508 KB
実行使用メモリ 56,516 KB
最終ジャッジ日時 2023-10-13 07:59:54
合計ジャッジ時間 7,725 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 119 ms
56,108 KB
testcase_01 AC 120 ms
56,516 KB
testcase_02 AC 120 ms
55,824 KB
testcase_03 AC 120 ms
56,000 KB
testcase_04 AC 121 ms
55,856 KB
testcase_05 AC 120 ms
55,856 KB
testcase_06 AC 122 ms
56,368 KB
testcase_07 AC 119 ms
56,344 KB
testcase_08 AC 118 ms
56,028 KB
testcase_09 AC 118 ms
56,048 KB
testcase_10 AC 119 ms
56,320 KB
testcase_11 AC 121 ms
56,212 KB
testcase_12 AC 121 ms
56,192 KB
testcase_13 AC 120 ms
56,168 KB
testcase_14 AC 119 ms
56,100 KB
testcase_15 AC 120 ms
56,000 KB
testcase_16 AC 119 ms
56,312 KB
testcase_17 AC 119 ms
55,984 KB
testcase_18 AC 138 ms
56,344 KB
testcase_19 AC 134 ms
55,940 KB
testcase_20 AC 134 ms
56,144 KB
testcase_21 AC 137 ms
55,888 KB
testcase_22 AC 137 ms
55,892 KB
testcase_23 AC 123 ms
56,072 KB
testcase_24 AC 125 ms
55,516 KB
testcase_25 AC 132 ms
56,080 KB
testcase_26 AC 132 ms
56,228 KB
testcase_27 AC 133 ms
56,260 KB
testcase_28 AC 134 ms
55,824 KB
testcase_29 AC 135 ms
56,384 KB
testcase_30 AC 137 ms
56,092 KB
testcase_31 AC 137 ms
56,240 KB
testcase_32 AC 138 ms
56,128 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long sum = 0;
		for (long idx = 1; idx <= Math.sqrt(n); idx++) {
		    if (n % idx == 0) {
		        sum += idx;
		        if (idx != n / idx) {
		            sum += n / idx;
		        }
		    }
		}
		System.out.println(sum);
	}
}
0