結果

問題 No.71 そろばん
ユーザー tsunabittsunabit
提出日時 2019-12-27 21:46:52
言語 Java21
(openjdk 21)
結果
AC  
実行時間 146 ms / 5,000 ms
コード長 430 bytes
コンパイル時間 3,607 ms
コンパイル使用メモリ 75,152 KB
実行使用メモリ 41,664 KB
最終ジャッジ日時 2024-04-17 19:08:37
合計ジャッジ時間 8,181 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 133 ms
41,392 KB
testcase_01 AC 133 ms
41,664 KB
testcase_02 AC 141 ms
41,500 KB
testcase_03 AC 127 ms
40,316 KB
testcase_04 AC 142 ms
41,544 KB
testcase_05 AC 144 ms
41,356 KB
testcase_06 AC 141 ms
41,384 KB
testcase_07 AC 127 ms
40,084 KB
testcase_08 AC 142 ms
41,136 KB
testcase_09 AC 128 ms
40,120 KB
testcase_10 AC 146 ms
41,500 KB
testcase_11 AC 140 ms
41,560 KB
testcase_12 AC 138 ms
41,452 KB
testcase_13 AC 139 ms
40,916 KB
testcase_14 AC 146 ms
41,288 KB
testcase_15 AC 144 ms
41,400 KB
testcase_16 AC 141 ms
41,416 KB
testcase_17 AC 142 ms
41,364 KB
testcase_18 AC 144 ms
41,284 KB
testcase_19 AC 144 ms
41,192 KB
testcase_20 AC 145 ms
41,520 KB
testcase_21 AC 143 ms
41,520 KB
testcase_22 AC 143 ms
41,528 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;
import java.io.*;
import java.math.*;

public class No71 {
//	private static Set<String> set = new HashSet<String>();
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long ans = 0;
		// 上の玉の数をiとする
		for(int i = 1; i < n; i++) {
			long tmp = (i + 1) * (n - i + 1) -1;
			ans = Math.max(ans, tmp);
		}
		System.out.println(ans);
	}
}
0