結果

問題 No.278 連続する整数の和(2)
ユーザー takeya_okinotakeya_okino
提出日時 2019-09-24 18:23:33
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 397 bytes
コンパイル時間 3,529 ms
コンパイル使用メモリ 73,600 KB
実行使用メモリ 57,792 KB
最終ジャッジ日時 2023-10-19 08:58:46
合計ジャッジ時間 6,535 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
55,500 KB
testcase_01 WA -
testcase_02 AC 156 ms
57,252 KB
testcase_03 AC 138 ms
57,524 KB
testcase_04 AC 135 ms
57,524 KB
testcase_05 AC 136 ms
57,548 KB
testcase_06 AC 135 ms
57,572 KB
testcase_07 AC 139 ms
57,524 KB
testcase_08 WA -
testcase_09 AC 151 ms
57,548 KB
testcase_10 AC 158 ms
57,556 KB
testcase_11 AC 153 ms
57,240 KB
testcase_12 WA -
testcase_13 AC 150 ms
57,792 KB
testcase_14 AC 153 ms
57,640 KB
testcase_15 AC 153 ms
57,600 KB
testcase_16 AC 144 ms
57,560 KB
testcase_17 AC 152 ms
57,684 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 = 0;
    if((n % 2) == 0) {
      n /= 2;
    } else {
      
    }
    for(long i = 1; (i * i) <= n; i++) {
      if((n % i) == 0) {
        long t = n / i;
        ans += (i + t);
      }
    }
    System.out.println(ans);
  }
}
0