結果

問題 No.129 お年玉(2)
ユーザー face4face4
提出日時 2018-08-27 14:40:06
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
MLE  
実行時間 -
コード長 781 bytes
コンパイル時間 1,733 ms
コンパイル使用メモリ 73,116 KB
実行使用メモリ 784,844 KB
最終ジャッジ日時 2023-09-13 19:33:54
合計ジャッジ時間 28,464 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
41,556 KB
testcase_01 MLE -
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 450 ms
321,364 KB
testcase_06 AC 714 ms
510,008 KB
testcase_07 MLE -
testcase_08 AC 593 ms
425,360 KB
testcase_09 MLE -
testcase_10 MLE -
testcase_11 AC 575 ms
407,932 KB
testcase_12 MLE -
testcase_13 MLE -
testcase_14 MLE -
testcase_15 AC 626 ms
443,436 KB
testcase_16 AC 710 ms
504,632 KB
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
testcase_21 MLE -
testcase_22 AC 608 ms
430,244 KB
testcase_23 MLE -
testcase_24 MLE -
testcase_25 AC 583 ms
410,448 KB
testcase_26 AC 593 ms
420,628 KB
testcase_27 AC 579 ms
407,692 KB
testcase_28 MLE -
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 7 ms
7,760 KB
testcase_34 AC 4 ms
4,784 KB
testcase_35 AC 7 ms
7,092 KB
testcase_36 AC 8 ms
7,732 KB
testcase_37 AC 10 ms
9,056 KB
testcase_38 AC 116 ms
86,200 KB
testcase_39 AC 182 ms
132,320 KB
testcase_40 AC 538 ms
380,760 KB
testcase_41 AC 328 ms
230,932 KB
testcase_42 AC 134 ms
98,048 KB
testcase_43 AC 133 ms
96,228 KB
testcase_44 MLE -
testcase_45 AC 74 ms
54,088 KB
testcase_46 AC 208 ms
148,324 KB
testcase_47 MLE -
testcase_48 AC 635 ms
449,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
using namespace std;

typedef long long ll;
ll mod = 1e9;

struct Combination{
    int n;
    vector<vector<ll>> dp;

    Combination(int i){
        n = i;
        dp = vector<vector<ll>>(n+1, vector<ll>(n+1, 0));
        constructTriangle();
    }

    void constructTriangle(){
        dp[0][0] = 1;
        for(int i = 1; i <= n; i++){
            dp[i][0] = dp[i-1][0];
            for(int j = 1; j <= i; j++){
                dp[i][j] = (dp[i-1][j] + dp[i-1][j-1]) % mod;
            }
        }
    }

    // return aCb
    ll getCombination(int a, int b){
        return dp[a][b];
    }
};

int main(){
    ll n, m;
    cin >> n >> m;

    n /= 1000;

    Combination c(m);

    cout << c.getCombination(m, n%m) << endl;

    return 0;
}
0