結果

問題 No.129 お年玉(2)
ユーザー kk
提出日時 2020-09-08 20:41:27
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 377 ms / 5,000 ms
コード長 660 bytes
コンパイル時間 1,924 ms
コンパイル使用メモリ 198,968 KB
実行使用メモリ 390,700 KB
最終ジャッジ日時 2023-08-20 06:47:00
合計ジャッジ時間 11,605 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
89,552 KB
testcase_01 AC 377 ms
377,124 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 136 ms
251,416 KB
testcase_06 AC 200 ms
316,868 KB
testcase_07 AC 242 ms
350,176 KB
testcase_08 AC 176 ms
290,236 KB
testcase_09 AC 224 ms
337,364 KB
testcase_10 AC 254 ms
356,432 KB
testcase_11 AC 168 ms
284,104 KB
testcase_12 AC 246 ms
325,336 KB
testcase_13 AC 255 ms
331,204 KB
testcase_14 AC 247 ms
327,132 KB
testcase_15 AC 213 ms
296,488 KB
testcase_16 AC 235 ms
314,920 KB
testcase_17 AC 290 ms
346,660 KB
testcase_18 AC 263 ms
337,364 KB
testcase_19 AC 277 ms
347,564 KB
testcase_20 AC 277 ms
346,188 KB
testcase_21 AC 331 ms
387,624 KB
testcase_22 AC 186 ms
292,388 KB
testcase_23 AC 263 ms
362,004 KB
testcase_24 AC 250 ms
354,816 KB
testcase_25 AC 168 ms
284,116 KB
testcase_26 AC 169 ms
288,196 KB
testcase_27 AC 165 ms
284,100 KB
testcase_28 AC 308 ms
389,348 KB
testcase_29 AC 2 ms
4,376 KB
testcase_30 AC 1 ms
4,376 KB
testcase_31 AC 2 ms
4,376 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 9 ms
32,192 KB
testcase_34 AC 5 ms
19,920 KB
testcase_35 AC 9 ms
30,160 KB
testcase_36 AC 9 ms
32,228 KB
testcase_37 AC 10 ms
36,308 KB
testcase_38 AC 50 ms
130,516 KB
testcase_39 AC 68 ms
161,320 KB
testcase_40 AC 157 ms
273,860 KB
testcase_41 AC 105 ms
212,580 KB
testcase_42 AC 55 ms
138,680 KB
testcase_43 AC 55 ms
136,672 KB
testcase_44 AC 309 ms
390,700 KB
testcase_45 AC 35 ms
101,844 KB
testcase_46 AC 75 ms
171,472 KB
testcase_47 AC 296 ms
383,732 KB
testcase_48 AC 181 ms
298,732 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define ALL(x) (x).begin(), (x).end()

const double PI = acos(-1);
const int MOD = 1e9;

int comb[10000+1][10000+1];

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);

  long long n;
  int m;
  cin >> n >> m;

  n /= 1000;
  n %= m;

  for (int i = 0; i <= m; i++) {
    comb[i][0] = comb[i][i] = 1;
    for (int j = 1; j < i; j++) {
      comb[i][j] = comb[i-1][j-1] + comb[i-1][j];
      if (comb[i][j] >= MOD)
        comb[i][j] -= MOD;
    }
  }

  cout << comb[m][n] << endl;
  
  return 0;
}
0