結果

問題 No.888 約数の総和
ユーザー neko_the_shadowneko_the_shadow
提出日時 2019-09-27 21:34:28
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 564 bytes
コンパイル時間 2,746 ms
コンパイル使用メモリ 88,188 KB
実行使用メモリ 57,940 KB
最終ジャッジ日時 2023-10-25 01:58:01
合計ジャッジ時間 9,463 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 137 ms
57,768 KB
testcase_01 AC 138 ms
57,576 KB
testcase_02 AC 138 ms
57,704 KB
testcase_03 AC 138 ms
57,640 KB
testcase_04 AC 141 ms
57,840 KB
testcase_05 AC 137 ms
57,664 KB
testcase_06 AC 140 ms
57,728 KB
testcase_07 AC 134 ms
57,688 KB
testcase_08 AC 138 ms
57,856 KB
testcase_09 AC 138 ms
57,612 KB
testcase_10 AC 136 ms
57,728 KB
testcase_11 AC 138 ms
57,836 KB
testcase_12 AC 151 ms
57,376 KB
testcase_13 AC 136 ms
57,732 KB
testcase_14 AC 136 ms
57,936 KB
testcase_15 AC 142 ms
57,608 KB
testcase_16 AC 137 ms
57,596 KB
testcase_17 AC 136 ms
57,668 KB
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 WA -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;

public class Main {

    public static void main(String[] args) {
        Scanner stdin = new Scanner(System.in);
        int n = stdin.nextInt();
        
        Set<Integer> facts = new HashSet<>();
        for (int fact = 1; fact * fact <= n; fact++) {
            if (n % fact != 0) continue;
            facts.add(fact);
            facts.add(n / fact);
        }
        
        int ans = facts.stream().mapToInt(Integer::intValue).sum();
        System.out.println(ans);
    }

}
0