結果

問題 No.888 約数の総和
ユーザー tentententen
提出日時 2020-08-30 21:52:43
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 408 bytes
コンパイル時間 2,256 ms
コンパイル使用メモリ 74,624 KB
実行使用メモリ 56,092 KB
最終ジャッジ日時 2024-04-27 13:25:05
合計ジャッジ時間 8,526 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
54,204 KB
testcase_01 AC 133 ms
53,964 KB
testcase_02 AC 142 ms
54,328 KB
testcase_03 WA -
testcase_04 AC 138 ms
53,976 KB
testcase_05 AC 136 ms
53,960 KB
testcase_06 AC 140 ms
54,432 KB
testcase_07 AC 135 ms
54,104 KB
testcase_08 AC 135 ms
53,992 KB
testcase_09 AC 135 ms
54,056 KB
testcase_10 AC 136 ms
54,100 KB
testcase_11 AC 135 ms
54,452 KB
testcase_12 AC 135 ms
54,252 KB
testcase_13 AC 136 ms
54,128 KB
testcase_14 AC 135 ms
54,140 KB
testcase_15 AC 136 ms
54,212 KB
testcase_16 AC 133 ms
54,272 KB
testcase_17 AC 131 ms
54,080 KB
testcase_18 AC 153 ms
54,180 KB
testcase_19 AC 156 ms
54,096 KB
testcase_20 AC 150 ms
54,264 KB
testcase_21 AC 155 ms
53,940 KB
testcase_22 AC 158 ms
56,092 KB
testcase_23 AC 140 ms
53,836 KB
testcase_24 AC 149 ms
54,300 KB
testcase_25 AC 145 ms
54,044 KB
testcase_26 AC 147 ms
54,224 KB
testcase_27 AC 152 ms
54,180 KB
testcase_28 AC 150 ms
54,324 KB
testcase_29 AC 152 ms
54,212 KB
testcase_30 AC 153 ms
54,316 KB
testcase_31 AC 154 ms
54,128 KB
testcase_32 AC 152 ms
54,160 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 ans = n + 1;
    	for (long i = 2; i <= Math.sqrt(n); i++) {
    	    if (n % i == 0) {
    	        ans += i;
    	        if (i * i < n) {
    	            ans += n / i;
    	        }
    	    }
    	}
    	System.out.println(ans);
    }
}
0