結果

問題 No.71 そろばん
ユーザー rn4rurn4ru
提出日時 2016-04-14 09:30:59
言語 Java21
(openjdk 21)
結果
AC  
実行時間 801 ms / 5,000 ms
コード長 568 bytes
コンパイル時間 2,107 ms
コンパイル使用メモリ 74,592 KB
実行使用メモリ 66,092 KB
最終ジャッジ日時 2024-04-15 01:20:24
合計ジャッジ時間 15,795 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
53,136 KB
testcase_01 AC 127 ms
54,072 KB
testcase_02 AC 801 ms
65,984 KB
testcase_03 AC 505 ms
61,408 KB
testcase_04 AC 561 ms
65,260 KB
testcase_05 AC 727 ms
64,688 KB
testcase_06 AC 765 ms
66,080 KB
testcase_07 AC 597 ms
65,424 KB
testcase_08 AC 522 ms
64,536 KB
testcase_09 AC 765 ms
65,284 KB
testcase_10 AC 575 ms
65,276 KB
testcase_11 AC 293 ms
58,488 KB
testcase_12 AC 410 ms
60,908 KB
testcase_13 AC 767 ms
66,092 KB
testcase_14 AC 467 ms
61,104 KB
testcase_15 AC 677 ms
64,720 KB
testcase_16 AC 311 ms
58,676 KB
testcase_17 AC 503 ms
65,140 KB
testcase_18 AC 696 ms
64,856 KB
testcase_19 AC 747 ms
65,144 KB
testcase_20 AC 760 ms
65,940 KB
testcase_21 AC 481 ms
61,592 KB
testcase_22 AC 651 ms
64,764 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();

		BigInteger max = BigInteger.ZERO;
		for (int i = 0; i < N; i++) {
			BigInteger upper = new BigInteger(String.valueOf(i));
			BigInteger lower = new BigInteger(String.valueOf(N - i));
			if (max.compareTo(upper.multiply(lower.add(BigInteger.ONE)).add(lower)) < 1) {
				max = upper.multiply(lower.add(BigInteger.ONE)).add(lower);
			}
		}

		System.out.println(max);
	}

}
0