結果

問題 No.129 お年玉(2)
ユーザー ferinferin
提出日時 2017-02-13 21:16:20
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 429 ms / 5,000 ms
コード長 844 bytes
コンパイル時間 1,996 ms
コンパイル使用メモリ 157,932 KB
実行使用メモリ 433,024 KB
最終ジャッジ日時 2024-05-05 23:13:36
合計ジャッジ時間 12,934 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 25 ms
31,616 KB
testcase_01 AC 429 ms
433,024 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 170 ms
187,904 KB
testcase_06 AC 259 ms
288,896 KB
testcase_07 AC 312 ms
350,208 KB
testcase_08 AC 235 ms
243,840 KB
testcase_09 AC 287 ms
323,840 KB
testcase_10 AC 325 ms
362,240 KB
testcase_11 AC 208 ms
234,368 KB
testcase_12 AC 267 ms
301,568 KB
testcase_13 AC 280 ms
314,880 KB
testcase_14 AC 273 ms
304,512 KB
testcase_15 AC 224 ms
253,440 KB
testcase_16 AC 257 ms
285,952 KB
testcase_17 AC 311 ms
343,808 KB
testcase_18 AC 293 ms
324,864 KB
testcase_19 AC 311 ms
345,600 KB
testcase_20 AC 307 ms
343,040 KB
testcase_21 AC 379 ms
423,680 KB
testcase_22 AC 224 ms
246,400 KB
testcase_23 AC 360 ms
372,864 KB
testcase_24 AC 316 ms
358,784 KB
testcase_25 AC 215 ms
235,776 KB
testcase_26 AC 215 ms
241,280 KB
testcase_27 AC 210 ms
234,368 KB
testcase_28 AC 379 ms
427,520 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 2 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 4 ms
5,760 KB
testcase_35 AC 6 ms
8,192 KB
testcase_36 AC 6 ms
8,704 KB
testcase_37 AC 8 ms
10,112 KB
testcase_38 AC 50 ms
57,856 KB
testcase_39 AC 72 ms
84,224 KB
testcase_40 AC 225 ms
219,904 KB
testcase_41 AC 119 ms
138,624 KB
testcase_42 AC 53 ms
64,768 KB
testcase_43 AC 53 ms
63,872 KB
testcase_44 AC 385 ms
429,696 KB
testcase_45 AC 32 ms
39,040 KB
testcase_46 AC 79 ms
93,056 KB
testcase_47 AC 374 ms
416,128 KB
testcase_48 AC 232 ms
256,640 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef pair<int, int> PII;

#define FOR(i, a, n) for (int i = (int)a; i < (int)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
#define MOD 1000000007
#define INF 1000000000
#define PI 3.14159265359
#define EPS 1e-12

ll dp[10010][10010];

int main(void)
{
  ll n, m;
  cin >> n >> m;
  ll a = n%(m*1000)/1000;
  if(a == 0) {
    cout << 1 << endl;
    return 0;
  }
  //cout << a << endl;
  //m人にa枚を配る
  REP(i, m+1) {
    REP(j, i+1) {
      if(j == 0 || j == i) dp[i][j] = 1;
      else dp[i][j] = (dp[i-1][j-1] + dp[i-1][j])%INF;
      //cout << dp[i][j] << " ";
    }
    //cout << endl;
  }

  cout << dp[m][a]%INF << endl;
  return 0;
}
0