結果

問題 No.129 お年玉(2)
ユーザー かにかに
提出日時 2015-11-18 01:32:02
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 457 ms / 5,000 ms
コード長 1,719 bytes
コンパイル時間 789 ms
コンパイル使用メモリ 90,092 KB
実行使用メモリ 394,068 KB
最終ジャッジ日時 2023-08-18 17:28:21
合計ジャッジ時間 9,986 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
89,684 KB
testcase_01 AC 457 ms
394,068 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 170 ms
252,452 KB
testcase_06 AC 156 ms
314,940 KB
testcase_07 AC 255 ms
339,032 KB
testcase_08 AC 226 ms
291,652 KB
testcase_09 AC 153 ms
322,324 KB
testcase_10 AC 278 ms
346,488 KB
testcase_11 AC 156 ms
285,136 KB
testcase_12 AC 73 ms
314,416 KB
testcase_13 AC 69 ms
315,228 KB
testcase_14 AC 166 ms
319,072 KB
testcase_15 AC 142 ms
297,156 KB
testcase_16 AC 181 ms
314,556 KB
testcase_17 AC 142 ms
324,976 KB
testcase_18 AC 250 ms
330,712 KB
testcase_19 AC 314 ms
344,832 KB
testcase_20 AC 223 ms
333,340 KB
testcase_21 AC 170 ms
341,040 KB
testcase_22 AC 181 ms
291,192 KB
testcase_23 AC 272 ms
365,216 KB
testcase_24 AC 344 ms
357,512 KB
testcase_25 AC 156 ms
284,952 KB
testcase_26 AC 203 ms
289,332 KB
testcase_27 AC 192 ms
285,264 KB
testcase_28 AC 228 ms
391,656 KB
testcase_29 AC 1 ms
4,380 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 2 ms
4,380 KB
testcase_32 AC 1 ms
4,380 KB
testcase_33 AC 8 ms
32,452 KB
testcase_34 AC 5 ms
19,976 KB
testcase_35 AC 7 ms
30,188 KB
testcase_36 AC 8 ms
32,476 KB
testcase_37 AC 9 ms
36,452 KB
testcase_38 AC 44 ms
130,804 KB
testcase_39 AC 49 ms
161,816 KB
testcase_40 AC 100 ms
274,296 KB
testcase_41 AC 104 ms
213,248 KB
testcase_42 AC 56 ms
139,372 KB
testcase_43 AC 32 ms
136,920 KB
testcase_44 AC 366 ms
392,420 KB
testcase_45 AC 35 ms
102,388 KB
testcase_46 AC 39 ms
171,692 KB
testcase_47 AC 322 ms
386,304 KB
testcase_48 AC 236 ms
299,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#define aLL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define F(i,j,k) fill(i[0],i[0]+j*j,k)
#define P(p) cout<<(p)<<endl;
#define EXISt(s,e) ((s).find(e)!=(s).end())
#define INF 1<<25
#define MAX 100000000
#define pb push_back
#define mp make_pair
using namespace std;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<double> vd;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef pair<pair<int, int>, int> pp;
typedef long long ll;
int dx[] = { 0, 1, 0, -1 };
int dy[] = { -1, 0, 1, 0 };

int sttoi(std::string str) {
	int ret;
	std::stringstream ss; ss << str;
	ss >> ret;
	return ret;
}

bool sort_greater(const pair<string, int> &a, const pair<string, int> &b) {
	return a.second > b.second;
}
int gcd(int a, int b){
	if (b > a)swap(a, b);if (b == 0)return a;else{return gcd(b, a%b);}
}

int dp[10001][10001];

void solve() {
	ll n, m;
	cin >> n >> m;
	n /= 1000;
	n %= m;
	dp[0][1] = 1;
	dp[0][2] = 1;
	for (int i = 1; i < m; i++){
		for (int j = 1; j < n+10; j++){
			dp[i][j] = ((dp[i - 1][j - 1] % 1000000000) + (dp[i - 1][j] % 1000000000)) % 1000000000;
		}
	}
	P(dp[m-1][n+1]%1000000000);
}

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