結果

問題 No.129 お年玉(2)
ユーザー Ai3ShotaAi3Shota
提出日時 2018-05-09 23:45:10
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1,293 ms / 5,000 ms
コード長 477 bytes
コンパイル時間 1,224 ms
コンパイル使用メモリ 143,828 KB
実行使用メモリ 233,356 KB
最終ジャッジ日時 2023-08-18 18:07:20
合計ジャッジ時間 20,392 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
20,440 KB
testcase_01 AC 47 ms
43,868 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 164 ms
71,984 KB
testcase_06 AC 767 ms
159,760 KB
testcase_07 AC 776 ms
183,148 KB
testcase_08 AC 154 ms
69,756 KB
testcase_09 AC 896 ms
164,992 KB
testcase_10 AC 688 ms
175,512 KB
testcase_11 AC 538 ms
132,148 KB
testcase_12 AC 229 ms
61,748 KB
testcase_13 AC 172 ms
55,096 KB
testcase_14 AC 830 ms
166,420 KB
testcase_15 AC 690 ms
141,252 KB
testcase_16 AC 730 ms
160,764 KB
testcase_17 AC 897 ms
159,316 KB
testcase_18 AC 638 ms
161,268 KB
testcase_19 AC 296 ms
108,248 KB
testcase_20 AC 885 ms
190,420 KB
testcase_21 AC 1,094 ms
193,552 KB
testcase_22 AC 518 ms
133,004 KB
testcase_23 AC 787 ms
188,196 KB
testcase_24 AC 147 ms
74,320 KB
testcase_25 AC 588 ms
133,948 KB
testcase_26 AC 362 ms
110,020 KB
testcase_27 AC 389 ms
113,716 KB
testcase_28 AC 1,293 ms
233,356 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 4 ms
5,344 KB
testcase_35 AC 5 ms
6,320 KB
testcase_36 AC 8 ms
7,508 KB
testcase_37 AC 8 ms
7,764 KB
testcase_38 AC 104 ms
36,732 KB
testcase_39 AC 154 ms
46,124 KB
testcase_40 AC 536 ms
107,492 KB
testcase_41 AC 268 ms
79,452 KB
testcase_42 AC 99 ms
39,000 KB
testcase_43 AC 71 ms
27,928 KB
testcase_44 AC 418 ms
137,532 KB
testcase_45 AC 52 ms
25,168 KB
testcase_46 AC 99 ms
34,576 KB
testcase_47 AC 681 ms
181,428 KB
testcase_48 AC 197 ms
80,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define MOD 1000000000

using namespace std;

long long N, M;
long long dp[10001][10001] = {{0}};

long long rec(long long n, long long r)
{
    if (r == 0 || r == n) return 1;
    else if (r == 1) return n % MOD;
    if(dp[n][r] != 0) return dp[n][r] % MOD;
    return dp[n][r] = (rec(n - 1, r - 1) % MOD + rec(n - 1, r) % MOD);
}

int main(void){
    
    cin >> N >> M;
    cout << rec(M, (N % (M * 1000)) / 1000) % MOD << endl;
    
    return 0;
}
0