結果

問題 No.129 お年玉(2)
ユーザー FF256grhyFF256grhy
提出日時 2017-06-16 15:19:35
言語 C++11
(gcc 11.4.0)
結果
MLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,857 bytes
コンパイル時間 1,144 ms
コンパイル使用メモリ 143,648 KB
実行使用メモリ 758,244 KB
最終ジャッジ日時 2023-08-18 17:56:38
合計ジャッジ時間 11,386 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
175,536 KB
testcase_01 MLE -
testcase_02 AC 26 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 174 ms
352,104 KB
testcase_06 AC 356 ms
470,536 KB
testcase_07 MLE -
testcase_08 AC 202 ms
498,004 KB
testcase_09 MLE -
testcase_10 MLE -
testcase_11 MLE -
testcase_12 MLE -
testcase_13 MLE -
testcase_14 MLE -
testcase_15 MLE -
testcase_16 MLE -
testcase_17 MLE -
testcase_18 MLE -
testcase_19 MLE -
testcase_20 MLE -
testcase_21 MLE -
testcase_22 MLE -
testcase_23 MLE -
testcase_24 MLE -
testcase_25 MLE -
testcase_26 MLE -
testcase_27 MLE -
testcase_28 MLE -
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 2 ms
5,504 KB
testcase_32 AC 1 ms
5,640 KB
testcase_33 AC 14 ms
62,892 KB
testcase_34 AC 8 ms
36,220 KB
testcase_35 AC 13 ms
58,820 KB
testcase_36 AC 14 ms
62,928 KB
testcase_37 AC 15 ms
71,024 KB
testcase_38 AC 63 ms
257,416 KB
testcase_39 AC 81 ms
320,880 KB
testcase_40 MLE -
testcase_41 AC 116 ms
423,336 KB
testcase_42 AC 67 ms
273,780 KB
testcase_43 AC 67 ms
271,740 KB
testcase_44 MLE -
testcase_45 AC 48 ms
202,160 KB
testcase_46 AC 85 ms
339,372 KB
testcase_47 MLE -
testcase_48 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define UB upper_bound
#define LB lower_bound
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

LL n, m, dp[10001][10001];

LL comb(LL a, LL b) {
	LL MOD = 1e9;
	incII(i, 0, a) {
	incII(j, 0, i) {
		dp[i][j] = (i == 0 ? 1 : dp[i - 1][j - 1] + dp[i - 1][j]) % MOD;
	}
	}
	return dp[a][b];
}

int main() {
	cin >> n >> m;
	
	n /= 1000;
	cout << comb(m, n % m) << endl;
	
	return 0;
}
0