結果

問題 No.888 約数の総和
ユーザー iwa_choco_168iwa_choco_168
提出日時 2019-12-08 18:29:14
言語 Java21
(openjdk 21)
結果
AC  
実行時間 139 ms / 2,000 ms
コード長 410 bytes
コンパイル時間 4,532 ms
コンパイル使用メモリ 71,064 KB
実行使用メモリ 55,928 KB
最終ジャッジ日時 2023-08-30 01:47:04
合計ジャッジ時間 8,168 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 117 ms
55,560 KB
testcase_01 AC 118 ms
55,468 KB
testcase_02 AC 118 ms
55,564 KB
testcase_03 AC 120 ms
55,616 KB
testcase_04 AC 120 ms
55,544 KB
testcase_05 AC 119 ms
55,716 KB
testcase_06 AC 119 ms
55,352 KB
testcase_07 AC 120 ms
55,620 KB
testcase_08 AC 119 ms
55,596 KB
testcase_09 AC 120 ms
55,920 KB
testcase_10 AC 121 ms
55,592 KB
testcase_11 AC 120 ms
55,508 KB
testcase_12 AC 118 ms
55,736 KB
testcase_13 AC 120 ms
55,408 KB
testcase_14 AC 119 ms
55,388 KB
testcase_15 AC 120 ms
55,728 KB
testcase_16 AC 119 ms
55,900 KB
testcase_17 AC 120 ms
55,624 KB
testcase_18 AC 137 ms
55,440 KB
testcase_19 AC 134 ms
55,592 KB
testcase_20 AC 129 ms
55,884 KB
testcase_21 AC 136 ms
55,796 KB
testcase_22 AC 139 ms
55,892 KB
testcase_23 AC 121 ms
55,364 KB
testcase_24 AC 130 ms
55,760 KB
testcase_25 AC 133 ms
55,652 KB
testcase_26 AC 132 ms
55,480 KB
testcase_27 AC 134 ms
55,916 KB
testcase_28 AC 133 ms
55,732 KB
testcase_29 AC 134 ms
55,660 KB
testcase_30 AC 135 ms
55,756 KB
testcase_31 AC 136 ms
55,448 KB
testcase_32 AC 136 ms
55,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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