結果

問題 No.287 場合の数
ユーザー xuzijian629xuzijian629
提出日時 2018-11-04 19:22:51
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 1,392 ms / 5,000 ms
コード長 651 bytes
コンパイル時間 2,207 ms
コンパイル使用メモリ 205,620 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-13 03:28:25
合計ジャッジ時間 17,415 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 700 ms
4,380 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 1,392 ms
4,384 KB
testcase_04 AC 1,334 ms
4,384 KB
testcase_05 AC 698 ms
4,384 KB
testcase_06 AC 5 ms
4,380 KB
testcase_07 AC 144 ms
4,384 KB
testcase_08 AC 341 ms
4,384 KB
testcase_09 AC 733 ms
4,380 KB
testcase_10 AC 1,338 ms
4,380 KB
testcase_11 AC 79 ms
4,384 KB
testcase_12 AC 1,088 ms
4,380 KB
testcase_13 AC 22 ms
4,380 KB
testcase_14 AC 187 ms
4,380 KB
testcase_15 AC 667 ms
4,380 KB
testcase_16 AC 213 ms
4,384 KB
testcase_17 AC 1,000 ms
4,380 KB
testcase_18 AC 134 ms
4,380 KB
testcase_19 AC 839 ms
4,384 KB
testcase_20 AC 271 ms
4,380 KB
testcase_21 AC 733 ms
4,380 KB
testcase_22 AC 666 ms
4,384 KB
testcase_23 AC 471 ms
4,380 KB
testcase_24 AC 200 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using vi = vector<i64>;
using vvi = vector<vi>;

int main() {
    int n;
    cin >> n;
    unordered_map<i64, i64> cnt;
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= n; j++) {
            for (int k = 0; k <= n; k++) {
                for (int l = 0; l <= n; l++) {
                    cnt[6 * n - i - j - k - l]++;
                }
            }
        }
    }

    i64 ans = 0;
    for (auto& p: cnt) {
        if (cnt.count(6 * n - p.first)) {
            ans += p.second * cnt[6 * n - p.first];
        }
    }
    cout << ans << endl;
}                       
0