結果

問題 No.2188 整数列コイントスゲーム
ユーザー hikikomorihikikomori
提出日時 2023-04-07 03:16:42
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 979 bytes
コンパイル時間 783 ms
コンパイル使用メモリ 107,644 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-10 16:10:47
合計ジャッジ時間 2,578 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 1 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,940 KB
testcase_08 AC 1 ms
6,944 KB
testcase_09 AC 1 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 1 ms
6,940 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 2 ms
6,940 KB
testcase_14 AC 1 ms
6,940 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 1 ms
6,940 KB
testcase_17 AC 1 ms
6,944 KB
testcase_18 AC 1 ms
6,944 KB
testcase_19 AC 2 ms
6,944 KB
testcase_20 AC 1 ms
6,944 KB
testcase_21 AC 2 ms
6,944 KB
testcase_22 AC 2 ms
6,944 KB
testcase_23 AC 1 ms
6,940 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 2 ms
6,940 KB
testcase_26 AC 1 ms
6,944 KB
testcase_27 AC 2 ms
6,944 KB
testcase_28 AC 1 ms
6,944 KB
testcase_29 AC 2 ms
6,940 KB
testcase_30 AC 2 ms
6,948 KB
testcase_31 AC 1 ms
6,940 KB
testcase_32 AC 1 ms
6,944 KB
testcase_33 AC 2 ms
6,944 KB
testcase_34 AC 2 ms
6,944 KB
testcase_35 AC 1 ms
6,944 KB
testcase_36 AC 1 ms
6,944 KB
testcase_37 AC 1 ms
6,940 KB
testcase_38 AC 1 ms
6,940 KB
testcase_39 AC 2 ms
6,940 KB
testcase_40 AC 1 ms
6,940 KB
testcase_41 AC 1 ms
6,944 KB
testcase_42 AC 1 ms
6,944 KB
testcase_43 AC 1 ms
6,940 KB
testcase_44 AC 1 ms
6,940 KB
testcase_45 AC 1 ms
6,940 KB
testcase_46 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include <map>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <algorithm>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <string>
using namespace std;

bool rcmp(int a, int b) { return a>b; }
typedef long long LL;



LL ft[32];
LL cc[16][16];
int main() {
    int n, i, j, m;
    scanf("%d %d", &n, &m);
    cc[0][0]=1; for (j=1; j<=n; j++) cc[0][j]=0;
    for (i=1; i<=n; i++) {
        for (j=i+1; j<=n; j++) cc[i][j]=0;
        cc[i][0]=0;
        for (j=1; j<=i; j++) {
            cc[i][j]=j*cc[i-1][j]+cc[i-1][j-1];
        }
        // for (j=1; j<=i; j++) printf("%d:%d => %lld\n", i, j, cc[i][j]);
    }
    ft[0]=1; for (i=1; i<=n; i++) ft[i]=ft[i-1]*i;
    for (i=1; i<=n; i++) {
        for (j=1; j<=i; j++) {
            cc[i][j]*=ft[j];
        }
    }
    if (m>n) printf("0\n");
    else printf("%lld\n", cc[n][m]);
    return 0;
}
0