結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
57,444 KB
testcase_01 AC 138 ms
57,096 KB
testcase_02 AC 134 ms
57,624 KB
testcase_03 AC 138 ms
55,684 KB
testcase_04 AC 134 ms
55,476 KB
testcase_05 AC 138 ms
57,404 KB
testcase_06 AC 139 ms
57,484 KB
testcase_07 AC 140 ms
57,388 KB
testcase_08 AC 140 ms
57,164 KB
testcase_09 AC 139 ms
57,648 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