結果

問題 No.71 そろばん
ユーザー tentententen
提出日時 2022-07-28 18:31:30
言語 Java21
(openjdk 21)
結果
AC  
実行時間 58 ms / 5,000 ms
コード長 1,095 bytes
コンパイル時間 2,188 ms
コンパイル使用メモリ 73,148 KB
実行使用メモリ 49,896 KB
最終ジャッジ日時 2023-09-25 11:19:46
合計ジャッジ時間 4,680 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
47,232 KB
testcase_01 AC 46 ms
49,284 KB
testcase_02 AC 56 ms
49,792 KB
testcase_03 AC 54 ms
49,656 KB
testcase_04 AC 56 ms
49,752 KB
testcase_05 AC 57 ms
47,784 KB
testcase_06 AC 58 ms
49,832 KB
testcase_07 AC 54 ms
49,524 KB
testcase_08 AC 54 ms
49,700 KB
testcase_09 AC 55 ms
49,820 KB
testcase_10 AC 55 ms
49,680 KB
testcase_11 AC 53 ms
49,808 KB
testcase_12 AC 52 ms
49,748 KB
testcase_13 AC 57 ms
49,664 KB
testcase_14 AC 55 ms
49,896 KB
testcase_15 AC 56 ms
49,856 KB
testcase_16 AC 52 ms
49,268 KB
testcase_17 AC 54 ms
49,708 KB
testcase_18 AC 56 ms
49,704 KB
testcase_19 AC 56 ms
49,748 KB
testcase_20 AC 56 ms
47,644 KB
testcase_21 AC 52 ms
49,596 KB
testcase_22 AC 56 ms
49,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    static HashSet<String> ans = new HashSet<>();
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        long n = sc.nextInt();
        long max = 0;
        for (int i = 0; i < n; i++) {
            max = Math.max(max, i * (n - i + 1) + n - i);
        }
        System.out.println(max);
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    
    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 String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0