結果

問題 No.287 場合の数
ユーザー tentententen
提出日時 2021-11-11 08:43:25
言語 Java21
(openjdk 21)
結果
AC  
実行時間 51 ms / 5,000 ms
コード長 1,543 bytes
コンパイル時間 1,851 ms
コンパイル使用メモリ 77,460 KB
実行使用メモリ 50,412 KB
最終ジャッジ日時 2024-05-02 00:01:18
合計ジャッジ時間 3,992 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
37,112 KB
testcase_01 AC 46 ms
49,928 KB
testcase_02 AC 46 ms
49,976 KB
testcase_03 AC 48 ms
50,260 KB
testcase_04 AC 48 ms
50,412 KB
testcase_05 AC 48 ms
49,800 KB
testcase_06 AC 49 ms
50,000 KB
testcase_07 AC 50 ms
49,852 KB
testcase_08 AC 50 ms
49,760 KB
testcase_09 AC 46 ms
49,964 KB
testcase_10 AC 51 ms
50,212 KB
testcase_11 AC 50 ms
50,160 KB
testcase_12 AC 49 ms
50,264 KB
testcase_13 AC 50 ms
49,956 KB
testcase_14 AC 49 ms
49,900 KB
testcase_15 AC 48 ms
50,296 KB
testcase_16 AC 47 ms
50,228 KB
testcase_17 AC 50 ms
50,244 KB
testcase_18 AC 48 ms
50,216 KB
testcase_19 AC 48 ms
50,240 KB
testcase_20 AC 48 ms
50,248 KB
testcase_21 AC 47 ms
50,176 KB
testcase_22 AC 46 ms
50,200 KB
testcase_23 AC 47 ms
50,180 KB
testcase_24 AC 46 ms
50,308 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int n = sc.nextInt();
        long[] counts2 = new long[2 * n + 1];
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n; j++) {
                counts2[i + j]++;
            }
        }
        long[] counts4 = new long[4 * n + 1];
        for (int i = 0; i <= 2 * n; i++) {
            for (int j = 0; j <= 2 * n; j++) {
                counts4[i + j] += counts2[i] * counts2[j];
            }
        }
        long ans = 0;
        for (int i = 2 * n; i <= 4 * n; i++) {
            ans += counts4[i] * counts4[6 * n - i];
        }
        System.out.println(ans);
    }
    
}
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 nextLine() throws Exception {
        return br.readLine();
    }
    
    public String next() throws Exception {
        if (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
}
0