結果
| 問題 | 
                            No.129 お年玉(2)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             ry0u_yd
                         | 
                    
| 提出日時 | 2015-09-02 22:50:29 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                MLE
                                 
                             
                            
                            (最新)
                                AC
                                 
                             
                            (最初)
                            
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 813 bytes | 
| コンパイル時間 | 822 ms | 
| コンパイル使用メモリ | 66,960 KB | 
| 実行使用メモリ | 554,732 KB | 
| 最終ジャッジ日時 | 2024-12-20 18:11:13 | 
| 合計ジャッジ時間 | 20,130 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 MLE * 2 | 
| other | AC * 4 MLE * 42 | 
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <sstream>
#include <map>
#include <set>
#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<30
#define pb push_back
#define mp make_pair
#define MOD 1000000000
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
ll dp[10005][10005];
int main() {
    ll n,m;
    cin >> n >> m;
    n = n/1000;
    if(n % m == 0) {
        cout << 1 << endl;
    } else {
        int d = n % m;
        rep(i,10005) {
            dp[i][0] = 1;
            dp[i][i] = 1;
            REP(j,1,i) {
                dp[i][j] = dp[i-1][j-1] + dp[i-1][j];
                dp[i][j] %= MOD;
            }
        }
        cout << dp[m][d] << endl;
    }
    return 0;
}
            
            
            
        
            
ry0u_yd