結果

問題 No.287 場合の数
ユーザー tentententen
提出日時 2020-10-16 19:21:12
言語 Java21
(openjdk 21)
結果
AC  
実行時間 119 ms / 5,000 ms
コード長 716 bytes
コンパイル時間 3,821 ms
コンパイル使用メモリ 71,864 KB
実行使用メモリ 57,844 KB
最終ジャッジ日時 2023-09-28 02:26:50
合計ジャッジ時間 8,388 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 114 ms
56,408 KB
testcase_01 AC 110 ms
56,068 KB
testcase_02 AC 111 ms
56,060 KB
testcase_03 AC 113 ms
56,032 KB
testcase_04 AC 119 ms
55,716 KB
testcase_05 AC 117 ms
55,680 KB
testcase_06 AC 116 ms
55,872 KB
testcase_07 AC 114 ms
56,304 KB
testcase_08 AC 113 ms
56,084 KB
testcase_09 AC 111 ms
56,028 KB
testcase_10 AC 114 ms
56,068 KB
testcase_11 AC 117 ms
55,856 KB
testcase_12 AC 116 ms
55,736 KB
testcase_13 AC 117 ms
55,988 KB
testcase_14 AC 115 ms
55,752 KB
testcase_15 AC 115 ms
55,608 KB
testcase_16 AC 113 ms
56,020 KB
testcase_17 AC 113 ms
55,936 KB
testcase_18 AC 113 ms
56,068 KB
testcase_19 AC 114 ms
57,844 KB
testcase_20 AC 115 ms
55,972 KB
testcase_21 AC 115 ms
55,664 KB
testcase_22 AC 113 ms
56,080 KB
testcase_23 AC 114 ms
56,424 KB
testcase_24 AC 110 ms
55,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] twin = new int[n * 2 + 1];
        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n; j++) {
                twin[i + j]++;
            }
        }
        int[] quad = new int[n * 4 + 1];
        for (int i = 0; i <= 2 * n; i++) {
            for (int j = 0; j <= 2 * n; j++) {
                quad[i + j] += twin[i] * twin[j];
            }
        }
        long ans = 0;
        for (int i = 2 * n; i <= 4 * n; i++) {
            ans += (long)quad[i] * quad[6 * n - i];
        }
        System.out.println(ans);
    }
} 
0