結果

問題 No.129 お年玉(2)
ユーザー kyunakyuna
提出日時 2019-08-19 17:35:43
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 358 ms / 5,000 ms
コード長 580 bytes
コンパイル時間 585 ms
コンパイル使用メモリ 74,736 KB
実行使用メモリ 394,624 KB
最終ジャッジ日時 2024-04-15 04:48:07
合計ジャッジ時間 19,219 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 344 ms
394,368 KB
testcase_01 AC 346 ms
394,240 KB
testcase_02 AC 349 ms
394,368 KB
testcase_03 AC 351 ms
394,368 KB
testcase_04 AC 347 ms
394,240 KB
testcase_05 AC 350 ms
394,368 KB
testcase_06 AC 349 ms
394,368 KB
testcase_07 AC 345 ms
394,240 KB
testcase_08 AC 349 ms
394,496 KB
testcase_09 AC 353 ms
394,368 KB
testcase_10 AC 349 ms
394,368 KB
testcase_11 AC 350 ms
394,368 KB
testcase_12 AC 347 ms
394,240 KB
testcase_13 AC 358 ms
394,240 KB
testcase_14 AC 349 ms
394,368 KB
testcase_15 AC 345 ms
394,368 KB
testcase_16 AC 351 ms
394,368 KB
testcase_17 AC 350 ms
394,368 KB
testcase_18 AC 348 ms
394,240 KB
testcase_19 AC 347 ms
394,496 KB
testcase_20 AC 348 ms
394,240 KB
testcase_21 AC 346 ms
394,624 KB
testcase_22 AC 345 ms
394,368 KB
testcase_23 AC 345 ms
394,240 KB
testcase_24 AC 349 ms
394,368 KB
testcase_25 AC 347 ms
394,240 KB
testcase_26 AC 348 ms
394,240 KB
testcase_27 AC 352 ms
394,240 KB
testcase_28 AC 348 ms
394,240 KB
testcase_29 AC 355 ms
394,240 KB
testcase_30 AC 353 ms
394,496 KB
testcase_31 AC 348 ms
394,240 KB
testcase_32 AC 353 ms
394,240 KB
testcase_33 AC 349 ms
394,240 KB
testcase_34 AC 353 ms
394,240 KB
testcase_35 AC 350 ms
394,496 KB
testcase_36 AC 353 ms
394,240 KB
testcase_37 AC 351 ms
394,368 KB
testcase_38 AC 345 ms
394,496 KB
testcase_39 AC 349 ms
394,368 KB
testcase_40 AC 348 ms
394,368 KB
testcase_41 AC 351 ms
394,240 KB
testcase_42 AC 346 ms
394,368 KB
testcase_43 AC 349 ms
394,368 KB
testcase_44 AC 350 ms
394,368 KB
testcase_45 AC 346 ms
394,496 KB
testcase_46 AC 348 ms
394,368 KB
testcase_47 AC 347 ms
394,368 KB
testcase_48 AC 345 ms
394,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
const int MOD = (int)1e9;

vector<vector<int>> get_combination(int ma) {
    vector<vector<int>> mat(ma + 1, vector<int>(ma + 1));
    for (int n = 0; n <= ma; n++) mat[n][0] = 1;
    for (int n = 1; n <= ma; n++) for (int r = 1; r <= n; r++) {
        mat[n][r] = (mat[n - 1][r - 1] + mat[n - 1][r]) % MOD;
    }
    return mat;
}

int main() {
    vector<vector<int>> comb = get_combination(10000);
    long long n, m; cin >> n >> m;
    cout << comb[m][n / 1000 % m] % MOD << endl;
    return 0;
}
0