結果

問題 No.129 お年玉(2)
ユーザー machymachy
提出日時 2015-06-16 21:58:29
言語 C++11
(gcc 11.4.0)
結果
MLE  
実行時間 -
コード長 708 bytes
コンパイル時間 599 ms
コンパイル使用メモリ 78,144 KB
実行使用メモリ 784,872 KB
最終ジャッジ日時 2023-09-21 09:07:28
合計ジャッジ時間 14,645 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
14,648 KB
testcase_01 MLE -
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 303 ms
270,460 KB
testcase_06 AC 248 ms
219,524 KB
testcase_07 AC 449 ms
399,772 KB
testcase_08 AC 437 ms
384,848 KB
testcase_09 AC 225 ms
194,228 KB
testcase_10 AC 513 ms
454,912 KB
testcase_11 AC 262 ms
231,144 KB
testcase_12 AC 31 ms
30,096 KB
testcase_13 AC 22 ms
21,768 KB
testcase_14 AC 252 ms
223,476 KB
testcase_15 AC 217 ms
190,204 KB
testcase_16 AC 297 ms
264,716 KB
testcase_17 AC 191 ms
168,560 KB
testcase_18 AC 448 ms
398,452 KB
testcase_19 MLE -
testcase_20 AC 373 ms
331,440 KB
testcase_21 AC 234 ms
209,484 KB
testcase_22 AC 306 ms
271,212 KB
testcase_23 AC 506 ms
447,664 KB
testcase_24 MLE -
testcase_25 AC 244 ms
217,888 KB
testcase_26 AC 357 ms
318,772 KB
testcase_27 AC 332 ms
295,352 KB
testcase_28 AC 387 ms
343,588 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 2 ms
4,376 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 1 ms
4,376 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 3 ms
4,688 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 42 ms
38,684 KB
testcase_39 AC 44 ms
40,316 KB
testcase_40 AC 124 ms
109,116 KB
testcase_41 AC 162 ms
140,972 KB
testcase_42 AC 73 ms
64,620 KB
testcase_43 AC 16 ms
15,536 KB
testcase_44 MLE -
testcase_45 AC 39 ms
35,764 KB
testcase_46 AC 19 ms
18,568 KB
testcase_47 MLE -
testcase_48 AC 450 ms
396,868 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>
#include <map>
using namespace std;
typedef long long LL;

const LL MOD=1000000000;

LL mod_comb(LL n, LL m){
    vector<vector<LL> > dp(n+1, vector<LL>(m+1));
    dp[0][0] = 1;
    for(int i = 0; i < n; i++){
        for(int j = 0; j <= m; j++){
            dp[i+1][j] += dp[i][j];
            dp[i+1][j] %= MOD;
        }
        for(int j = 0; j < m; j++){
            dp[i+1][j+1] += dp[i][j];
            dp[i+1][j+1] %= MOD;
        }
    }
    return dp[n][m];
}

int main(){
    LL N, M;
    cin >> N >> M;
    LL cnt = (N/1000) % M;
    cout << mod_comb(M, cnt) << endl;
    return 0;
}
0