結果

問題 No.129 お年玉(2)
ユーザー しらっ亭しらっ亭
提出日時 2016-03-31 19:03:59
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 473 ms / 5,000 ms
コード長 970 bytes
コンパイル時間 1,473 ms
コンパイル使用メモリ 144,156 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-18 17:36:43
合計ジャッジ時間 9,121 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
4,376 KB
testcase_01 AC 473 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 159 ms
4,380 KB
testcase_06 AC 130 ms
4,380 KB
testcase_07 AC 251 ms
4,376 KB
testcase_08 AC 234 ms
4,376 KB
testcase_09 AC 120 ms
4,376 KB
testcase_10 AC 277 ms
4,380 KB
testcase_11 AC 145 ms
4,380 KB
testcase_12 AC 19 ms
4,384 KB
testcase_13 AC 12 ms
4,380 KB
testcase_14 AC 137 ms
4,376 KB
testcase_15 AC 113 ms
4,380 KB
testcase_16 AC 161 ms
4,380 KB
testcase_17 AC 100 ms
4,380 KB
testcase_18 AC 243 ms
4,376 KB
testcase_19 AC 332 ms
4,376 KB
testcase_20 AC 200 ms
4,380 KB
testcase_21 AC 131 ms
4,376 KB
testcase_22 AC 169 ms
4,376 KB
testcase_23 AC 280 ms
4,376 KB
testcase_24 AC 365 ms
4,376 KB
testcase_25 AC 133 ms
4,380 KB
testcase_26 AC 205 ms
4,376 KB
testcase_27 AC 185 ms
4,380 KB
testcase_28 AC 209 ms
4,380 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 2 ms
4,380 KB
testcase_33 AC 2 ms
4,380 KB
testcase_34 AC 2 ms
4,380 KB
testcase_35 AC 2 ms
4,376 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 23 ms
4,376 KB
testcase_39 AC 24 ms
4,376 KB
testcase_40 AC 68 ms
4,380 KB
testcase_41 AC 86 ms
4,380 KB
testcase_42 AC 39 ms
4,376 KB
testcase_43 AC 9 ms
4,376 KB
testcase_44 AC 413 ms
4,380 KB
testcase_45 AC 21 ms
4,376 KB
testcase_46 AC 11 ms
4,376 KB
testcase_47 AC 353 ms
4,380 KB
testcase_48 AC 256 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FORR(x,arr) for(auto&& x:arr)
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); i--)
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i,n) for (int i = (n)-1; i >= 0; i--)
#define ALL(x) (x).begin(), (x).end()
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define BIT(n) (1LL<<(n))
#define SZ(x) ((int)(x).size())
typedef long long ll;
// -------------------------------------

#define MOD 1000000000

ll N, M;

ll dp[20101];

void Main() {
  cin >> N >> M;

  ll s = N / 1000;
  ll a = s - (s / M) * M;

  dp[0] = 1;

  FOR(i, 1, a+2) {
    FOR(j, 1, M+1) {
      (dp[j] += dp[j-1]) %= MOD;
    }
  }
  cout << dp[M-a] << endl;
}
int main() { cin.tie(0); ios::sync_with_stdio(false); Main(); return 0; }
0