結果

問題 No.129 お年玉(2)
ユーザー tkmst201tkmst201
提出日時 2017-04-24 10:43:17
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 600 ms / 5,000 ms
コード長 905 bytes
コンパイル時間 1,126 ms
コンパイル使用メモリ 144,120 KB
実行使用メモリ 357,188 KB
最終ジャッジ日時 2023-08-18 17:54:03
合計ジャッジ時間 15,937 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
89,848 KB
testcase_01 AC 600 ms
343,704 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 251 ms
230,328 KB
testcase_06 AC 395 ms
284,084 KB
testcase_07 AC 490 ms
316,484 KB
testcase_08 AC 326 ms
260,208 KB
testcase_09 AC 431 ms
302,808 KB
testcase_10 AC 488 ms
322,812 KB
testcase_11 AC 313 ms
255,408 KB
testcase_12 AC 408 ms
290,952 KB
testcase_13 AC 422 ms
298,000 KB
testcase_14 AC 406 ms
292,372 KB
testcase_15 AC 338 ms
265,488 KB
testcase_16 AC 384 ms
282,676 KB
testcase_17 AC 462 ms
313,064 KB
testcase_18 AC 434 ms
303,396 KB
testcase_19 AC 470 ms
314,204 KB
testcase_20 AC 466 ms
312,860 KB
testcase_21 AC 573 ms
353,868 KB
testcase_22 AC 331 ms
261,552 KB
testcase_23 AC 501 ms
328,512 KB
testcase_24 AC 478 ms
321,144 KB
testcase_25 AC 321 ms
255,888 KB
testcase_26 AC 323 ms
258,740 KB
testcase_27 AC 314 ms
255,196 KB
testcase_28 AC 578 ms
356,096 KB
testcase_29 AC 2 ms
4,504 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 1 ms
4,380 KB
testcase_33 AC 10 ms
32,384 KB
testcase_34 AC 5 ms
19,916 KB
testcase_35 AC 9 ms
30,256 KB
testcase_36 AC 10 ms
32,520 KB
testcase_37 AC 12 ms
36,332 KB
testcase_38 AC 77 ms
130,524 KB
testcase_39 AC 106 ms
161,396 KB
testcase_40 AC 295 ms
247,348 KB
testcase_41 AC 182 ms
203,972 KB
testcase_42 AC 84 ms
138,792 KB
testcase_43 AC 82 ms
136,684 KB
testcase_44 AC 583 ms
357,188 KB
testcase_45 AC 51 ms
101,956 KB
testcase_46 AC 120 ms
171,480 KB
testcase_47 AC 562 ms
350,172 KB
testcase_48 AC 341 ms
266,988 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-10;

int ncr[10001][10001];

void nCr(ll n, ll r, ll mod) {
	REP(i, n + 1) {
		REP(j, i + 1) {
			if (j == 0 || j == i) ncr[i][j] = 1;
			else ncr[i][j] = (ncr[i - 1][j - 1] + ncr[i - 1][j]) % mod;
		}
	}
}

int main() {
	ll mod = 1000000000;
	ll n, m;
	cin >> n >> m;
	
	nCr(m, m, mod);
	
	n /= 1000;
	n %= m;
	
	cout << ncr[m][n] << endl;
	
	return 0;
}
0