結果

問題 No.278 連続する整数の和(2)
ユーザー Grenache
提出日時 2015-09-05 09:21:17
言語 Java
(openjdk 23)
結果
WA  
実行時間 -
コード長 601 bytes
コンパイル時間 3,056 ms
コンパイル使用メモリ 74,124 KB
実行使用メモリ 41,328 KB
最終ジャッジ日時 2024-07-19 03:46:14
合計ジャッジ時間 6,130 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 17 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;


public class Main_yukicoder278_1 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        long n = sc.nextLong();

        if (n == 1) {
        } else if (n % 2 == 1) {
        } else {
        	n = n / 2;
        }

        if (n != 1) {
        	long ret = 0;
        	for (long j = 1; j * j <= n; j++) {
        		if (n % j == 0) {
        			ret += j;
        			ret += n / j;
        		}
        	}
		
        	System.out.println(ret);
        } else {
        	System.out.println("1");
        }
		
		sc.close();
    }
}
0