結果
問題 |
No.71 そろばん
|
ユーザー |
|
提出日時 | 2016-04-14 09:30:59 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 713 ms / 5,000 ms |
コード長 | 568 bytes |
コンパイル時間 | 1,840 ms |
コンパイル使用メモリ | 75,548 KB |
実行使用メモリ | 66,460 KB |
最終ジャッジ日時 | 2024-10-04 08:31:07 |
合計ジャッジ時間 | 14,079 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 20 |
ソースコード
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); } }