結果

問題 No.129 お年玉(2)
ユーザー 🍡yurahuna🍡yurahuna
提出日時 2016-02-26 16:36:45
言語 C++11
(gcc 11.4.0)
結果
MLE  
(最新)
AC  
(最初)
実行時間 -
コード長 984 bytes
コンパイル時間 753 ms
コンパイル使用メモリ 74,300 KB
実行使用メモリ 623,792 KB
最終ジャッジ日時 2023-08-03 12:46:11
合計ジャッジ時間 21,806 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 61 ms
175,516 KB
testcase_01 MLE -
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 337 ms
381,852 KB
testcase_06 AC 532 ms
484,108 KB
testcase_07 MLE -
testcase_08 AC 439 ms
439,080 KB
testcase_09 MLE -
testcase_10 MLE -
testcase_11 AC 425 ms
429,660 KB
testcase_12 AC 551 ms
496,832 KB
testcase_13 AC 573 ms
510,044 KB
testcase_14 AC 557 ms
499,792 KB
testcase_15 AC 456 ms
448,504 KB
testcase_16 AC 518 ms
481,296 KB
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
testcase_21 MLE -
testcase_22 AC 444 ms
441,544 KB
testcase_23 MLE -
testcase_24 MLE -
testcase_25 AC 430 ms
430,960 KB
testcase_26 AC 438 ms
436,632 KB
testcase_27 AC 429 ms
429,532 KB
testcase_28 MLE -
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 2 ms
5,776 KB
testcase_32 AC 2 ms
5,504 KB
testcase_33 AC 16 ms
63,028 KB
testcase_34 AC 9 ms
36,188 KB
testcase_35 AC 15 ms
58,768 KB
testcase_36 AC 16 ms
63,088 KB
testcase_37 AC 19 ms
71,112 KB
testcase_38 AC 106 ms
253,360 KB
testcase_39 AC 153 ms
278,124 KB
testcase_40 AC 398 ms
413,700 KB
testcase_41 AC 250 ms
333,848 KB
testcase_42 AC 117 ms
258,660 KB
testcase_43 AC 117 ms
259,080 KB
testcase_44 MLE -
testcase_45 AC 75 ms
202,188 KB
testcase_46 AC 169 ms
288,604 KB
testcase_47 MLE -
testcase_48 AC 491 ms
451,836 KB
権限があれば一括ダウンロードができます

ソースコード

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