結果

問題 No.71 そろばん
ユーザー tentententen
提出日時 2023-04-14 09:31:31
言語 Java21
(openjdk 21)
結果
AC  
実行時間 76 ms / 5,000 ms
コード長 1,609 bytes
コンパイル時間 3,073 ms
コンパイル使用メモリ 89,556 KB
実行使用メモリ 38,100 KB
最終ジャッジ日時 2024-04-18 09:25:24
合計ジャッジ時間 5,033 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
37,064 KB
testcase_01 AC 55 ms
37,084 KB
testcase_02 AC 72 ms
37,996 KB
testcase_03 AC 67 ms
37,300 KB
testcase_04 AC 68 ms
37,916 KB
testcase_05 AC 76 ms
37,932 KB
testcase_06 AC 70 ms
37,764 KB
testcase_07 AC 69 ms
37,952 KB
testcase_08 AC 67 ms
37,952 KB
testcase_09 AC 64 ms
38,080 KB
testcase_10 AC 65 ms
37,924 KB
testcase_11 AC 67 ms
37,364 KB
testcase_12 AC 67 ms
37,872 KB
testcase_13 AC 76 ms
37,676 KB
testcase_14 AC 74 ms
37,636 KB
testcase_15 AC 73 ms
37,936 KB
testcase_16 AC 60 ms
37,360 KB
testcase_17 AC 76 ms
37,972 KB
testcase_18 AC 76 ms
37,756 KB
testcase_19 AC 71 ms
37,944 KB
testcase_20 AC 69 ms
38,100 KB
testcase_21 AC 68 ms
37,760 KB
testcase_22 AC 68 ms
37,696 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        long ans = 0;
        for (long i = 0; i <= n; i++) {
            ans = Math.max(ans, (i + 1) * (n - i + 1) - 1);
        }
        System.out.println(ans);
    }
}
class Utilities {
    static String arrayToLineString(Object[] arr) {
        return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n"));
    }
    
    static String arrayToLineString(int[] arr) {
        return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new));
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public int[] nextIntArray() throws Exception {
        return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0