結果

問題 No.71 そろばん
ユーザー tentententen
提出日時 2020-11-17 13:01:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 135 ms / 5,000 ms
コード長 332 bytes
コンパイル時間 3,522 ms
コンパイル使用メモリ 71,676 KB
実行使用メモリ 56,208 KB
最終ジャッジ日時 2023-09-30 14:10:36
合計ジャッジ時間 7,758 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
56,120 KB
testcase_01 AC 124 ms
55,712 KB
testcase_02 AC 134 ms
55,892 KB
testcase_03 AC 133 ms
55,992 KB
testcase_04 AC 135 ms
56,004 KB
testcase_05 AC 133 ms
56,184 KB
testcase_06 AC 134 ms
56,168 KB
testcase_07 AC 133 ms
56,072 KB
testcase_08 AC 132 ms
56,208 KB
testcase_09 AC 134 ms
56,036 KB
testcase_10 AC 134 ms
55,864 KB
testcase_11 AC 130 ms
55,908 KB
testcase_12 AC 133 ms
56,036 KB
testcase_13 AC 133 ms
55,540 KB
testcase_14 AC 134 ms
55,784 KB
testcase_15 AC 134 ms
56,048 KB
testcase_16 AC 132 ms
56,108 KB
testcase_17 AC 135 ms
55,804 KB
testcase_18 AC 134 ms
55,944 KB
testcase_19 AC 134 ms
56,112 KB
testcase_20 AC 135 ms
56,096 KB
testcase_21 AC 134 ms
55,904 KB
testcase_22 AC 133 ms
55,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long max = 0;
        for (long i = 0; i < n; i++) {
            max = Math.max((n - i + 1) * i + (n - i), max);
        }
        System.out.println(max);
    }
}
0