結果

問題 No.71 そろばん
ユーザー Tsukasa_TypeTsukasa_Type
提出日時 2018-02-17 22:23:44
言語 Java21
(openjdk 21)
結果
AC  
実行時間 111 ms / 5,000 ms
コード長 337 bytes
コンパイル時間 3,438 ms
コンパイル使用メモリ 70,440 KB
実行使用メモリ 39,304 KB
最終ジャッジ日時 2023-09-06 17:56:32
合計ジャッジ時間 6,168 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
38,936 KB
testcase_01 AC 102 ms
38,612 KB
testcase_02 AC 105 ms
38,872 KB
testcase_03 AC 111 ms
38,856 KB
testcase_04 AC 105 ms
38,800 KB
testcase_05 AC 88 ms
37,664 KB
testcase_06 AC 102 ms
39,216 KB
testcase_07 AC 101 ms
39,048 KB
testcase_08 AC 99 ms
39,024 KB
testcase_09 AC 100 ms
38,992 KB
testcase_10 AC 85 ms
37,704 KB
testcase_11 AC 85 ms
37,876 KB
testcase_12 AC 97 ms
38,812 KB
testcase_13 AC 102 ms
38,888 KB
testcase_14 AC 83 ms
37,972 KB
testcase_15 AC 99 ms
39,036 KB
testcase_16 AC 98 ms
38,996 KB
testcase_17 AC 100 ms
39,108 KB
testcase_18 AC 103 ms
39,304 KB
testcase_19 AC 88 ms
37,904 KB
testcase_20 AC 93 ms
38,592 KB
testcase_21 AC 108 ms
38,972 KB
testcase_22 AC 104 ms
38,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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