結果
| 問題 | 
                            No.129 お年玉(2)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             chakku
                         | 
                    
| 提出日時 | 2015-09-29 01:56:54 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                MLE
                                 
                             
                            
                            (最新)
                                AC
                                 
                             
                            (最初)
                            
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 952 bytes | 
| コンパイル時間 | 598 ms | 
| コンパイル使用メモリ | 71,240 KB | 
| 実行使用メモリ | 535,120 KB | 
| 最終ジャッジ日時 | 2024-10-12 19:53:56 | 
| 合計ジャッジ時間 | 43,617 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | MLE * 3 | 
| other | MLE * 46 | 
ソースコード
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <cstring>
#include <climits>
#include <cmath>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define REP(i,x,n) for(ll i=x;i<n;i++)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<":"<<x<<endl
#define debug2(x,y) cout<<#x<<":"<<#y<<"=="<<x<<":"<<y<<endl
const int INF = INT_MAX / 3;
const int dx[] = { 1, 0, -1, 0 }, dy[] = { 0, 1, 0, -1 };
#define MOD 1000000007
typedef pair<int,int> P;
typedef long long ll;
ll M = 1000000000;
ll m, n;
ll c[10001][10001];
int main(){
	cin >> n >> m;
	ll a = n / m;
	a = a - (a % 1000);
	ll amari = n - m * a;
	ll num = amari / 1000;
	rep(i, 10001){
		c[i][i] = 1;
		c[i][0] = 1;
	}
	for (int i = 1; i <= 10000; i++){
		for (int j = 1; j < i; j++){
			c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % M;
		}
	}
	cout << c[m][num] << endl;
	return 0;
}
            
            
            
        
            
chakku