結果

問題 No.129 お年玉(2)
ユーザー dnish
提出日時 2018-06-22 17:30:52
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
MLE  
実行時間 -
コード長 654 bytes
コンパイル時間 1,497 ms
コンパイル使用メモリ 166,236 KB
実行使用メモリ 792,576 KB
最終ジャッジ日時 2024-06-30 18:02:04
合計ジャッジ時間 19,321 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 41 MLE * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
#define REP(i,n,N) for(ll i=(n); i<(N); i++)
#define RREP(i,n,N) for(ll i=(N-1); i>=n; i--)
#define CK(n,a,b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define p(s) cout<<(s)<<endl
#define p2(a,b) cout<<(a)<<" "<<(b)<<endl
#define v2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll mod= 1e9;


ll dp[10010][10100];
int main(){
    ll N, M;
    cin >> N >> M;
    N/=1000LL;
    N%=M;
    dp[0][0]=1;
    REP(i,0,M){
        REP(j,0,N+1){
            (dp[i+1][j] += dp[i][j]) %= mod;
            if(j+1<=N) (dp[i+1][j+1] += dp[i][j]) %= mod;
        }
    }
    p(dp[M][N]);
    return 0;
}
0