結果

問題 No.2120 場合の数の下8桁
ユーザー 👑 chro_96chro_96
提出日時 2022-11-04 22:05:57
言語 C
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 617 bytes
コンパイル時間 620 ms
コンパイル使用メモリ 28,800 KB
実行使用メモリ 40,948 KB
最終ジャッジ日時 2023-09-26 00:30:50
合計ジャッジ時間 2,754 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 12 ms
40,876 KB
testcase_01 AC 12 ms
40,844 KB
testcase_02 AC 13 ms
40,760 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 12 ms
40,944 KB
testcase_06 AC 11 ms
40,824 KB
testcase_07 AC 12 ms
40,884 KB
testcase_08 AC 11 ms
40,748 KB
testcase_09 AC 11 ms
40,820 KB
testcase_10 AC 12 ms
40,852 KB
testcase_11 AC 12 ms
40,820 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 RE -
testcase_18 AC 12 ms
40,724 KB
testcase_19 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

int main () {
  int m = 0;
  int n = 0;
  
  int res = 0;
  
  long long ans = 1LL;
  long long mul[5000000] = {};
  
  res = scanf("%d", &m);
  res = scanf("%d", &n);
  
  if (m < n) {
    printf("00000000\n");
    return 0;
  }
  
  if (m-n < n) {
    n = m-n;
  }
  
  for (int i = 0; i < n; i++) {
    mul[i] = (long long) (m-i);
  }
  
  for (int j = n; j > 0; j--) {
    int idx = m%j;
    while (mul[idx]%j != 0 && idx < n) {
      idx += j;
    }
    mul[idx] /= j;
  }
  
  for (int i = 0; i < n; i++) {
    ans = (ans*mul[i])%100000000LL;
  }
  
  printf("%08lld\n", ans);
  return 0;
}
0