結果

問題 No.129 お年玉(2)
ユーザー hotpepsihotpepsi
提出日時 2015-01-24 01:25:02
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 299 ms / 5,000 ms
コード長 571 bytes
コンパイル時間 9,684 ms
コンパイル使用メモリ 409,760 KB
実行使用メモリ 236,928 KB
最終ジャッジ日時 2023-12-23 14:46:26
合計ジャッジ時間 18,917 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 20 ms
22,144 KB
testcase_01 AC 299 ms
236,928 KB
testcase_02 AC 4 ms
6,676 KB
testcase_03 AC 3 ms
6,676 KB
testcase_04 AC 3 ms
6,676 KB
testcase_05 AC 106 ms
108,672 KB
testcase_06 AC 165 ms
162,432 KB
testcase_07 AC 197 ms
194,816 KB
testcase_08 AC 137 ms
138,496 KB
testcase_09 AC 185 ms
180,864 KB
testcase_10 AC 205 ms
201,216 KB
testcase_11 AC 133 ms
133,504 KB
testcase_12 AC 172 ms
169,216 KB
testcase_13 AC 179 ms
176,128 KB
testcase_14 AC 175 ms
170,752 KB
testcase_15 AC 147 ms
143,616 KB
testcase_16 AC 164 ms
160,896 KB
testcase_17 AC 195 ms
191,488 KB
testcase_18 AC 183 ms
181,504 KB
testcase_19 AC 197 ms
192,384 KB
testcase_20 AC 199 ms
190,976 KB
testcase_21 AC 237 ms
232,192 KB
testcase_22 AC 142 ms
139,904 KB
testcase_23 AC 212 ms
206,720 KB
testcase_24 AC 205 ms
199,424 KB
testcase_25 AC 136 ms
134,272 KB
testcase_26 AC 138 ms
137,088 KB
testcase_27 AC 136 ms
133,504 KB
testcase_28 AC 240 ms
234,112 KB
testcase_29 AC 3 ms
6,676 KB
testcase_30 AC 3 ms
6,676 KB
testcase_31 AC 4 ms
6,676 KB
testcase_32 AC 3 ms
6,676 KB
testcase_33 AC 7 ms
7,808 KB
testcase_34 AC 5 ms
6,676 KB
testcase_35 AC 7 ms
7,424 KB
testcase_36 AC 7 ms
7,808 KB
testcase_37 AC 7 ms
8,704 KB
testcase_38 AC 37 ms
37,376 KB
testcase_39 AC 52 ms
52,096 KB
testcase_40 AC 133 ms
125,696 KB
testcase_41 AC 81 ms
82,048 KB
testcase_42 AC 40 ms
41,216 KB
testcase_43 AC 40 ms
40,704 KB
testcase_44 AC 245 ms
235,264 KB
testcase_45 AC 26 ms
26,496 KB
testcase_46 AC 56 ms
57,088 KB
testcase_47 AC 238 ms
228,480 KB
testcase_48 AC 148 ms
145,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <sstream>
#include <cstdio>

using namespace std;

#define COMBSZ 10001
#define MOD 1000000000LL
typedef long long LL;

int main(int argc, char *argv[])
{
	static int C[COMBSZ][COMBSZ] = { 1 };

	string s;
	getline(cin, s);
	LL N, M;
	stringstream ss(s);
	ss >> N;
	getline(cin, s);
	M = atoi(s.c_str());
	N /= 1000;
	N %= M;

	for (LL i = 1; i <= M; ++i) {
		C[i][0] = 1;
		for (LL j = 1; j <= i; ++j) {
			C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % MOD;
		}
	}

	LL ans = C[M][M-N];
	cout << ans << endl;
	return 0;
}
0