結果

問題 No.129 お年玉(2)
ユーザー 🍡yurahuna🍡yurahuna
提出日時 2016-02-26 16:36:45
言語 C++11
(gcc 11.4.0)
結果
MLE  
(最新)
AC  
(最初)
実行時間 -
コード長 984 bytes
コンパイル時間 696 ms
コンパイル使用メモリ 74,120 KB
実行使用メモリ 747,884 KB
最終ジャッジ日時 2024-05-01 08:06:42
合計ジャッジ時間 17,849 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 51 ms
85,376 KB
testcase_01 AC 791 ms
487,136 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 312 ms
243,696 KB
testcase_06 AC 555 ms
342,808 KB
testcase_07 AC 630 ms
415,052 KB
testcase_08 AC 416 ms
312,076 KB
testcase_09 AC 543 ms
435,096 KB
testcase_10 AC 617 ms
483,572 KB
testcase_11 AC 397 ms
355,364 KB
testcase_12 AC 560 ms
422,564 KB
testcase_13 AC 569 ms
494,676 KB
testcase_14 AC 513 ms
492,188 KB
testcase_15 AC 425 ms
442,240 KB
testcase_16 AC 476 ms
473,504 KB
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
testcase_21 MLE -
testcase_22 AC 828 ms
435,244 KB
testcase_23 MLE -
testcase_24 MLE -
testcase_25 AC 409 ms
444,136 KB
testcase_26 AC 421 ms
451,624 KB
testcase_27 AC 399 ms
445,052 KB
testcase_28 MLE -
testcase_29 AC 2 ms
6,940 KB
testcase_30 AC 1 ms
6,940 KB
testcase_31 AC 3 ms
7,540 KB
testcase_32 AC 3 ms
7,540 KB
testcase_33 AC 17 ms
62,896 KB
testcase_34 AC 8 ms
36,276 KB
testcase_35 AC 14 ms
58,752 KB
testcase_36 AC 15 ms
63,024 KB
testcase_37 AC 19 ms
73,200 KB
testcase_38 AC 100 ms
257,564 KB
testcase_39 AC 150 ms
293,992 KB
testcase_40 AC 377 ms
499,236 KB
testcase_41 AC 236 ms
425,324 KB
testcase_42 AC 116 ms
275,692 KB
testcase_43 AC 112 ms
271,896 KB
testcase_44 MLE -
testcase_45 AC 76 ms
202,160 KB
testcase_46 AC 157 ms
339,320 KB
testcase_47 MLE -
testcase_48 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <complex>
#include <queue>
#include <map>
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define pb push_back
#define ALL(a) (a).begin(),(a).end()

#define EPS (1e-10)
#define EQ(a,b) (abs((a)-(b)) < EPS)

#define PI 3.1415926535

typedef long long ll;
typedef pair<int, int> P;
//typedef complex<double> C;

const int MAX_M = 10000;

ll mod = 1000000000;
ll N, M;
ll C[MAX_M + 1][MAX_M + 1];

void input() {
	cin >> N >> M;
}

void setPascal(int N) {
	REP(i, N + 1) {
		C[i][0] = C[i][i] = 1;
	}
	FOR(i, 1, N + 1) {
		FOR(j, 1, i) {
			C[i][j] = (C[i-1][j-1] + C[i-1][j]) % mod;
		}
	}
}

void solve() {
	N /= 1000;
	if (N == 0) {
		cout << 1 << endl;
		return;
	}
	int r = N % M;
	setPascal(M);
	cout << C[M][r] << endl;
}

int main() {
	input();
	solve();
}
0