結果

問題 No.129 お年玉(2)
ユーザー chakkuchakku
提出日時 2015-09-29 01:56:54
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 840 ms / 5,000 ms
コード長 952 bytes
コンパイル時間 653 ms
コンパイル使用メモリ 71,304 KB
実行使用メモリ 458,076 KB
最終ジャッジ日時 2024-04-20 21:39:08
合計ジャッジ時間 39,728 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 750 ms
457,880 KB
testcase_01 AC 762 ms
457,804 KB
testcase_02 AC 759 ms
457,944 KB
testcase_03 AC 751 ms
457,832 KB
testcase_04 AC 749 ms
457,824 KB
testcase_05 AC 754 ms
457,832 KB
testcase_06 AC 762 ms
457,940 KB
testcase_07 AC 773 ms
457,856 KB
testcase_08 AC 757 ms
457,848 KB
testcase_09 AC 758 ms
457,820 KB
testcase_10 AC 738 ms
457,900 KB
testcase_11 AC 750 ms
457,976 KB
testcase_12 AC 762 ms
457,908 KB
testcase_13 AC 770 ms
457,840 KB
testcase_14 AC 743 ms
457,780 KB
testcase_15 AC 746 ms
457,760 KB
testcase_16 AC 743 ms
457,972 KB
testcase_17 AC 745 ms
457,996 KB
testcase_18 AC 740 ms
457,808 KB
testcase_19 AC 744 ms
457,900 KB
testcase_20 AC 745 ms
457,752 KB
testcase_21 AC 749 ms
457,812 KB
testcase_22 AC 745 ms
457,756 KB
testcase_23 AC 743 ms
457,976 KB
testcase_24 AC 840 ms
457,848 KB
testcase_25 AC 762 ms
457,888 KB
testcase_26 AC 757 ms
457,820 KB
testcase_27 AC 756 ms
457,816 KB
testcase_28 AC 754 ms
458,076 KB
testcase_29 AC 753 ms
457,976 KB
testcase_30 AC 752 ms
457,736 KB
testcase_31 AC 762 ms
457,952 KB
testcase_32 AC 748 ms
457,904 KB
testcase_33 AC 758 ms
457,944 KB
testcase_34 AC 767 ms
457,976 KB
testcase_35 AC 760 ms
457,756 KB
testcase_36 AC 756 ms
457,748 KB
testcase_37 AC 759 ms
457,764 KB
testcase_38 AC 768 ms
457,828 KB
testcase_39 AC 756 ms
457,768 KB
testcase_40 AC 754 ms
457,992 KB
testcase_41 AC 762 ms
457,940 KB
testcase_42 AC 746 ms
457,816 KB
testcase_43 AC 764 ms
457,828 KB
testcase_44 AC 750 ms
457,824 KB
testcase_45 AC 752 ms
457,940 KB
testcase_46 AC 761 ms
457,900 KB
testcase_47 AC 759 ms
457,884 KB
testcase_48 AC 768 ms
457,896 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0