結果

問題 No.129 お年玉(2)
ユーザー tnakao0123tnakao0123
提出日時 2016-03-21 01:31:28
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 192 ms / 5,000 ms
コード長 897 bytes
コンパイル時間 831 ms
コンパイル使用メモリ 83,132 KB
実行使用メモリ 390,704 KB
最終ジャッジ日時 2023-08-18 17:36:02
合計ジャッジ時間 6,449 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
89,708 KB
testcase_01 AC 192 ms
373,736 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 100 ms
245,520 KB
testcase_06 AC 129 ms
306,120 KB
testcase_07 AC 150 ms
338,556 KB
testcase_08 AC 104 ms
282,236 KB
testcase_09 AC 136 ms
324,636 KB
testcase_10 AC 153 ms
344,652 KB
testcase_11 AC 98 ms
276,980 KB
testcase_12 AC 136 ms
312,904 KB
testcase_13 AC 115 ms
331,392 KB
testcase_14 AC 115 ms
327,260 KB
testcase_15 AC 100 ms
296,580 KB
testcase_16 AC 110 ms
315,140 KB
testcase_17 AC 129 ms
346,860 KB
testcase_18 AC 122 ms
337,612 KB
testcase_19 AC 132 ms
347,560 KB
testcase_20 AC 126 ms
346,440 KB
testcase_21 AC 163 ms
387,692 KB
testcase_22 AC 96 ms
292,712 KB
testcase_23 AC 141 ms
361,864 KB
testcase_24 AC 135 ms
354,796 KB
testcase_25 AC 92 ms
284,260 KB
testcase_26 AC 96 ms
288,396 KB
testcase_27 AC 93 ms
284,300 KB
testcase_28 AC 168 ms
389,480 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 2 ms
4,380 KB
testcase_31 AC 1 ms
4,380 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 8 ms
32,444 KB
testcase_34 AC 5 ms
20,352 KB
testcase_35 AC 7 ms
30,312 KB
testcase_36 AC 8 ms
32,348 KB
testcase_37 AC 9 ms
36,448 KB
testcase_38 AC 34 ms
130,928 KB
testcase_39 AC 43 ms
161,388 KB
testcase_40 AC 87 ms
274,028 KB
testcase_41 AC 64 ms
212,592 KB
testcase_42 AC 37 ms
138,996 KB
testcase_43 AC 36 ms
136,804 KB
testcase_44 AC 168 ms
390,704 KB
testcase_45 AC 26 ms
101,996 KB
testcase_46 AC 47 ms
171,616 KB
testcase_47 AC 157 ms
383,768 KB
testcase_48 AC 99 ms
298,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 129.cc: No.129 お年玉(2) - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_M = 10000;
const int MOD = 1000000000;

/* typedef */

typedef long long ll;

/* global variables */

int combs[MAX_M + 1][MAX_M + 1];

/* subroutines */

/* main */

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

  int k = (n / 1000) % m;

  for (int i = 0; i <= m; i++) {
    combs[i][0] = combs[i][i] = 1;
    for (int j = 1; j < i; j++)
      combs[i][j] = (combs[i - 1][j - 1] + combs[i - 1][j]) % MOD;
  }

  printf("%d\n", combs[m][k]);
  return 0;
}
0