結果

問題 No.287 場合の数
ユーザー nasadigitalnasadigital
提出日時 2015-10-11 06:14:28
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1,153 ms / 5,000 ms
コード長 600 bytes
コンパイル時間 1,212 ms
コンパイル使用メモリ 167,152 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-25 12:33:36
合計ジャッジ時間 13,426 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 576 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 1 ms
5,376 KB
testcase_03 AC 1,153 ms
5,376 KB
testcase_04 AC 1,101 ms
5,376 KB
testcase_05 AC 581 ms
5,376 KB
testcase_06 AC 4 ms
5,376 KB
testcase_07 AC 119 ms
5,376 KB
testcase_08 AC 295 ms
5,376 KB
testcase_09 AC 596 ms
5,376 KB
testcase_10 AC 1,116 ms
5,376 KB
testcase_11 AC 64 ms
5,376 KB
testcase_12 AC 883 ms
5,376 KB
testcase_13 AC 19 ms
5,376 KB
testcase_14 AC 157 ms
5,376 KB
testcase_15 AC 552 ms
5,376 KB
testcase_16 AC 175 ms
5,376 KB
testcase_17 AC 825 ms
5,376 KB
testcase_18 AC 113 ms
5,376 KB
testcase_19 AC 685 ms
5,376 KB
testcase_20 AC 230 ms
5,376 KB
testcase_21 AC 594 ms
5,376 KB
testcase_22 AC 532 ms
5,376 KB
testcase_23 AC 374 ms
5,376 KB
testcase_24 AC 157 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int main()
{
    int n;
    cin>>n;
    unordered_map<int,int> hm;
    for(int ctr1=0;ctr1<=n;ctr1++){
        for(int ctr2=0;ctr2<=n;ctr2++){
            for(int ctr3=0;ctr3<=n;ctr3++){
                for(int ctr4=0;ctr4<=n;ctr4++){
                    hm[ctr1+ctr2+ctr3+ctr4]++;
                }
            }
        }
    }
    ll r=0;
    for(int ctr1=0;ctr1<3*n;ctr1++){
        //cout<<hm[ctr1]<<" "<<hm[6*n-ctr1]<<endl;
        r+=2LL*hm[ctr1]*hm[6*n-ctr1];
    }
    cout<<r+1LL*hm[3*n]*hm[3*n]<<endl;
    return 0;
}
0