結果

問題 No.129 お年玉(2)
ユーザー imgry22imgry22
提出日時 2015-05-13 14:25:37
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 477 ms / 5,000 ms
コード長 1,342 bytes
コンパイル時間 1,489 ms
コンパイル使用メモリ 157,676 KB
実行使用メモリ 437,620 KB
最終ジャッジ日時 2024-04-21 10:36:09
合計ジャッジ時間 13,373 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
31,616 KB
testcase_01 AC 477 ms
435,884 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 204 ms
191,880 KB
testcase_06 AC 308 ms
291,160 KB
testcase_07 AC 367 ms
359,848 KB
testcase_08 AC 261 ms
253,776 KB
testcase_09 AC 337 ms
335,276 KB
testcase_10 AC 376 ms
371,988 KB
testcase_11 AC 247 ms
244,228 KB
testcase_12 AC 311 ms
311,296 KB
testcase_13 AC 324 ms
324,432 KB
testcase_14 AC 315 ms
314,572 KB
testcase_15 AC 266 ms
263,044 KB
testcase_16 AC 297 ms
295,564 KB
testcase_17 AC 358 ms
354,000 KB
testcase_18 AC 338 ms
334,416 KB
testcase_19 AC 360 ms
355,408 KB
testcase_20 AC 361 ms
352,592 KB
testcase_21 AC 441 ms
433,584 KB
testcase_22 AC 261 ms
256,244 KB
testcase_23 AC 390 ms
382,848 KB
testcase_24 AC 371 ms
368,380 KB
testcase_25 AC 251 ms
245,736 KB
testcase_26 AC 257 ms
252,928 KB
testcase_27 AC 247 ms
243,920 KB
testcase_28 AC 442 ms
437,620 KB
testcase_29 AC 2 ms
6,940 KB
testcase_30 AC 2 ms
6,944 KB
testcase_31 AC 3 ms
7,440 KB
testcase_32 AC 4 ms
7,696 KB
testcase_33 AC 11 ms
18,524 KB
testcase_34 AC 5 ms
5,888 KB
testcase_35 AC 7 ms
8,320 KB
testcase_36 AC 8 ms
8,832 KB
testcase_37 AC 9 ms
10,112 KB
testcase_38 AC 59 ms
57,856 KB
testcase_39 AC 84 ms
84,224 KB
testcase_40 AC 219 ms
219,904 KB
testcase_41 AC 155 ms
161,616 KB
testcase_42 AC 59 ms
64,768 KB
testcase_43 AC 59 ms
63,744 KB
testcase_44 AC 428 ms
430,080 KB
testcase_45 AC 43 ms
61,904 KB
testcase_46 AC 94 ms
116,192 KB
testcase_47 AC 414 ms
416,384 KB
testcase_48 AC 265 ms
279,568 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define erep(i, m, n) for(int (i)=(m); (i)<=(n); (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define rrev(i, m, n) for(int (i)=(n)-1; (i)>=(m); (i)--)
#define erev(i, m, n) for(int (i)=(n); (i)>=(m); (i)--)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define pb            push_back
template<class T, class S> inline pair<T, S> mp(T x, S y){ return make_pair(x, y); }
template<class T, class S> inline bool minup(T& m, S x){ return m>(T)x ? (m=(T)x, true) : false; }
template<class T, class S> inline bool maxup(T& m, S x){ return m<(T)x ? (m=(T)x, true) : false; }

static const int    INF = 1000000000;
static const ll     MOD = 1000000000LL;
static const double EPS = 1E-12;


const int MAX_M = 10100;
ll n, m;
ll dp[MAX_M+1][MAX_M+1];

int main()
{
  cin >> n >> m;

  n =  (n - n / 1000LL / m * 1000 * m) / 1000;

  dp[0][0] = 1LL;
  erep(i, 0, m) erep(j, 0, i) dp[i+1][j+1] = (dp[i][j] + dp[i][j+1]) % MOD;

  cout << dp[(int)m+1][(int)n+1] << endl;

  return 0;
}
0