結果

問題 No.111 あばばばば
ユーザー takeya_okinotakeya_okino
提出日時 2017-06-25 19:46:54
言語 Java21
(openjdk 21)
結果
AC  
実行時間 155 ms / 5,000 ms
コード長 293 bytes
コンパイル時間 2,479 ms
コンパイル使用メモリ 74,576 KB
実行使用メモリ 42,060 KB
最終ジャッジ日時 2024-04-15 01:37:52
合計ジャッジ時間 4,750 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 148 ms
42,060 KB
testcase_01 AC 152 ms
41,320 KB
testcase_02 AC 155 ms
41,516 KB
testcase_03 AC 147 ms
41,856 KB
testcase_04 AC 152 ms
41,788 KB
testcase_05 AC 151 ms
41,488 KB
testcase_06 AC 145 ms
41,320 KB
testcase_07 AC 141 ms
41,504 KB
testcase_08 AC 139 ms
41,620 KB
testcase_09 AC 135 ms
41,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long L = sc.nextLong();
    long a = (L + 1) / 2;
    long b = (L - 1) / 2;
    long ans = (a * (a - 1)) / 2 + (b * (b - 1)) / 2;
    System.out.println(ans);
  }
}
0