結果

問題 No.287 場合の数
ユーザー nasadigitalnasadigital
提出日時 2015-10-11 06:14:28
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1,331 ms / 5,000 ms
コード長 600 bytes
コンパイル時間 1,303 ms
コンパイル使用メモリ 153,408 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-07 19:00:25
合計ジャッジ時間 15,813 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 669 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1,331 ms
4,376 KB
testcase_04 AC 1,278 ms
4,376 KB
testcase_05 AC 668 ms
4,380 KB
testcase_06 AC 5 ms
4,380 KB
testcase_07 AC 138 ms
4,380 KB
testcase_08 AC 330 ms
4,380 KB
testcase_09 AC 701 ms
4,376 KB
testcase_10 AC 1,278 ms
4,376 KB
testcase_11 AC 76 ms
4,376 KB
testcase_12 AC 1,045 ms
4,376 KB
testcase_13 AC 22 ms
4,376 KB
testcase_14 AC 180 ms
4,380 KB
testcase_15 AC 639 ms
4,376 KB
testcase_16 AC 204 ms
4,380 KB
testcase_17 AC 957 ms
4,376 KB
testcase_18 AC 128 ms
4,380 KB
testcase_19 AC 804 ms
4,380 KB
testcase_20 AC 260 ms
4,380 KB
testcase_21 AC 701 ms
4,376 KB
testcase_22 AC 639 ms
4,380 KB
testcase_23 AC 451 ms
4,376 KB
testcase_24 AC 192 ms
4,380 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