結果

問題 No.129 お年玉(2)
ユーザー kk
提出日時 2020-09-08 20:41:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 314 ms / 5,000 ms
コード長 660 bytes
コンパイル時間 1,956 ms
コンパイル使用メモリ 202,184 KB
実行使用メモリ 391,912 KB
最終ジャッジ日時 2024-05-07 14:06:40
合計ジャッジ時間 10,633 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
89,708 KB
testcase_01 AC 314 ms
391,912 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 145 ms
251,424 KB
testcase_06 AC 205 ms
317,420 KB
testcase_07 AC 240 ms
348,932 KB
testcase_08 AC 179 ms
290,236 KB
testcase_09 AC 228 ms
334,760 KB
testcase_10 AC 252 ms
356,240 KB
testcase_11 AC 169 ms
284,108 KB
testcase_12 AC 214 ms
324,344 KB
testcase_13 AC 231 ms
331,272 KB
testcase_14 AC 219 ms
325,996 KB
testcase_15 AC 185 ms
296,488 KB
testcase_16 AC 204 ms
316,152 KB
testcase_17 AC 254 ms
347,104 KB
testcase_18 AC 238 ms
337,116 KB
testcase_19 AC 245 ms
346,156 KB
testcase_20 AC 242 ms
345,092 KB
testcase_21 AC 306 ms
387,000 KB
testcase_22 AC 188 ms
292,236 KB
testcase_23 AC 265 ms
361,036 KB
testcase_24 AC 259 ms
354,436 KB
testcase_25 AC 179 ms
284,328 KB
testcase_26 AC 180 ms
290,164 KB
testcase_27 AC 169 ms
284,200 KB
testcase_28 AC 304 ms
388,900 KB
testcase_29 AC 2 ms
6,940 KB
testcase_30 AC 2 ms
6,944 KB
testcase_31 AC 2 ms
6,940 KB
testcase_32 AC 2 ms
6,944 KB
testcase_33 AC 9 ms
34,232 KB
testcase_34 AC 5 ms
20,060 KB
testcase_35 AC 8 ms
32,176 KB
testcase_36 AC 8 ms
32,252 KB
testcase_37 AC 9 ms
38,412 KB
testcase_38 AC 50 ms
130,500 KB
testcase_39 AC 70 ms
163,388 KB
testcase_40 AC 162 ms
274,012 KB
testcase_41 AC 108 ms
214,504 KB
testcase_42 AC 54 ms
138,876 KB
testcase_43 AC 55 ms
138,668 KB
testcase_44 AC 300 ms
389,388 KB
testcase_45 AC 36 ms
102,164 KB
testcase_46 AC 76 ms
171,488 KB
testcase_47 AC 290 ms
383,264 KB
testcase_48 AC 190 ms
298,456 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