結果

問題 No.129 お年玉(2)
ユーザー machy
提出日時 2015-06-16 21:58:29
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
MLE  
実行時間 -
コード長 708 bytes
コンパイル時間 737 ms
コンパイル使用メモリ 78,952 KB
実行使用メモリ 785,024 KB
最終ジャッジ日時 2024-07-07 03:22:51
合計ジャッジ時間 15,115 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41 MLE * 5
権限があれば一括ダウンロードができます

ソースコード

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