結果

問題 No.129 お年玉(2)
ユーザー Ai3ShotaAi3Shota
提出日時 2018-06-27 16:59:15
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1,140 ms / 5,000 ms
コード長 489 bytes
コンパイル時間 1,114 ms
コンパイル使用メモリ 157,644 KB
実行使用メモリ 233,600 KB
最終ジャッジ日時 2024-05-05 23:47:14
合計ジャッジ時間 20,758 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
20,608 KB
testcase_01 AC 29 ms
44,160 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 300 ms
72,064 KB
testcase_06 AC 645 ms
159,872 KB
testcase_07 AC 1,023 ms
183,424 KB
testcase_08 AC 300 ms
70,016 KB
testcase_09 AC 644 ms
165,376 KB
testcase_10 AC 961 ms
175,872 KB
testcase_11 AC 636 ms
132,224 KB
testcase_12 AC 96 ms
61,952 KB
testcase_13 AC 76 ms
55,296 KB
testcase_14 AC 696 ms
166,784 KB
testcase_15 AC 556 ms
141,184 KB
testcase_16 AC 744 ms
161,024 KB
testcase_17 AC 529 ms
159,616 KB
testcase_18 AC 853 ms
161,408 KB
testcase_19 AC 536 ms
108,672 KB
testcase_20 AC 947 ms
190,336 KB
testcase_21 AC 676 ms
193,664 KB
testcase_22 AC 648 ms
133,120 KB
testcase_23 AC 1,051 ms
188,416 KB
testcase_24 AC 299 ms
74,624 KB
testcase_25 AC 597 ms
134,272 KB
testcase_26 AC 547 ms
110,080 KB
testcase_27 AC 554 ms
113,664 KB
testcase_28 AC 1,140 ms
233,600 KB
testcase_29 AC 1 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 1 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 4 ms
5,504 KB
testcase_35 AC 4 ms
6,272 KB
testcase_36 AC 7 ms
7,552 KB
testcase_37 AC 7 ms
7,808 KB
testcase_38 AC 79 ms
36,864 KB
testcase_39 AC 96 ms
46,208 KB
testcase_40 AC 310 ms
107,776 KB
testcase_41 AC 298 ms
79,744 KB
testcase_42 AC 104 ms
39,168 KB
testcase_43 AC 42 ms
28,160 KB
testcase_44 AC 749 ms
137,856 KB
testcase_45 AC 52 ms
25,344 KB
testcase_46 AC 55 ms
34,816 KB
testcase_47 AC 1,026 ms
181,632 KB
testcase_48 AC 348 ms
80,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define MOD 1000000000
#define MAX 10001
typedef long long ll;
using namespace std;

ll N, M;

ll dp[MAX][MAX] = {{0}};

ll nCr(ll n, ll r)
{
       if(n==r) return dp[n][r] = 1;
       if(r==0) return dp[n][r] = 1;
       if(r==1) return dp[n][r] = n;
       if(dp[n][r]) return dp[n][r] % MOD;
       return dp[n][r] = nCr(n-1,r) + nCr(n-1,r-1);
}

int main(void){
    
    cin >> N >> M;
    cout << nCr(M, (N / 1000) % M) % MOD << endl;

    
    return 0;
}

0