結果

問題 No.276 連続する整数の和(1)
ユーザー takeya_okinotakeya_okino
提出日時 2019-09-22 14:01:06
言語 Java21
(openjdk 21)
結果
AC  
実行時間 141 ms / 1,000 ms
コード長 260 bytes
コンパイル時間 2,111 ms
コンパイル使用メモリ 73,880 KB
実行使用メモリ 57,736 KB
最終ジャッジ日時 2023-10-19 07:11:33
合計ジャッジ時間 4,229 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 141 ms
57,488 KB
testcase_01 AC 138 ms
57,392 KB
testcase_02 AC 139 ms
57,524 KB
testcase_03 AC 134 ms
57,216 KB
testcase_04 AC 139 ms
57,396 KB
testcase_05 AC 138 ms
57,736 KB
testcase_06 AC 139 ms
57,440 KB
testcase_07 AC 138 ms
57,448 KB
testcase_08 AC 136 ms
57,516 KB
testcase_09 AC 140 ms
57,480 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong();
    if(n % 2 == 0) {
      System.out.println(n / 2);
    } else {
      System.out.println(n);
    }
  }
}
0