結果

問題 No.278 連続する整数の和(2)
ユーザー nanophoto12nanophoto12
提出日時 2015-09-13 17:36:56
言語 Java21
(openjdk 21)
結果
AC  
実行時間 165 ms / 2,000 ms
コード長 642 bytes
コンパイル時間 2,028 ms
コンパイル使用メモリ 71,812 KB
実行使用メモリ 58,616 KB
最終ジャッジ日時 2023-08-24 22:43:31
合計ジャッジ時間 5,667 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
56,148 KB
testcase_01 AC 122 ms
55,664 KB
testcase_02 AC 161 ms
58,024 KB
testcase_03 AC 124 ms
55,988 KB
testcase_04 AC 124 ms
55,912 KB
testcase_05 AC 127 ms
56,040 KB
testcase_06 AC 131 ms
55,996 KB
testcase_07 AC 130 ms
56,036 KB
testcase_08 AC 161 ms
58,548 KB
testcase_09 AC 161 ms
58,616 KB
testcase_10 AC 163 ms
57,996 KB
testcase_11 AC 164 ms
58,172 KB
testcase_12 AC 121 ms
55,880 KB
testcase_13 AC 165 ms
58,008 KB
testcase_14 AC 153 ms
58,544 KB
testcase_15 AC 155 ms
58,052 KB
testcase_16 AC 153 ms
57,980 KB
testcase_17 AC 160 ms
58,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package com.company;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Long value = scanner.nextLong();
        if(value % 2 == 0)
        {
            value /=2;
        }
        Long sum = 0L;
        for(Long i = 1L; i * i <= value;i++)
        {
            if(value % i == 0)
            {
                Long other = value / i;
                sum += i;
                if(i < other)
                {
                    sum += other;
                }
            }
        }

        System.out.println(sum.toString());
    }
}
0