結果

問題 No.2625 Bouns Ai
ユーザー 👑 chro_96chro_96
提出日時 2024-02-09 22:29:46
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 960 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 31,104 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-09 22:30:05
合計ジャッジ時間 1,008 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,676 KB
testcase_01 AC 1 ms
6,676 KB
testcase_02 AC 0 ms
6,676 KB
testcase_03 AC 1 ms
6,676 KB
testcase_04 AC 1 ms
6,676 KB
testcase_05 AC 1 ms
6,676 KB
testcase_06 AC 1 ms
6,676 KB
testcase_07 AC 1 ms
6,676 KB
testcase_08 AC 1 ms
6,676 KB
testcase_09 AC 1 ms
6,676 KB
testcase_10 AC 0 ms
6,676 KB
testcase_11 AC 1 ms
6,676 KB
testcase_12 AC 1 ms
6,676 KB
testcase_13 AC 1 ms
6,676 KB
testcase_14 AC 0 ms
6,676 KB
testcase_15 AC 1 ms
6,676 KB
testcase_16 AC 1 ms
6,676 KB
testcase_17 AC 1 ms
6,676 KB
testcase_18 AC 1 ms
6,676 KB
testcase_19 AC 1 ms
6,676 KB
testcase_20 AC 0 ms
6,676 KB
testcase_21 AC 1 ms
6,676 KB
testcase_22 AC 0 ms
6,676 KB
testcase_23 AC 1 ms
6,676 KB
testcase_24 AC 1 ms
6,676 KB
testcase_25 AC 1 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>

long long power_mod (long long a, long long b, long long mod_num) {
  long long ans = 1LL;
  
  if (b > 0LL) {
    ans = power_mod(a, b/2LL, mod_num);
    ans = (ans * ans) % mod_num;
    if (b%2LL > 0LL) {
      ans = (ans * (a % mod_num)) % mod_num;
    }
  }
  
  return ans;
}

int main () {
  int n = 0;
  int a[201] = {};
  
  int res = 0;
  
  long long ans = 1LL;
  long long mod_num = 998244353LL;
  
  int sum = 0;
  long long div = 1LL;
  
  res = scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    res = scanf("%d", a+(i+1));
  }
  
  for (int i = 0; i < n; i++) {
    if (a[i] < a[i+1]) {
      sum += a[i+1]-a[i];
    }
  }
  
  if (sum > 100000) {
    printf("0\n");
    return 0;
  }
  
  for (int i = 0; i < n; i++) {
    ans *= (long long)(100000-sum+n-i);
    ans %= mod_num;
    div *= (long long)(i+1);
    div %= mod_num;
  }
  
  printf("%lld\n", (ans*power_mod(div, mod_num-2LL, mod_num))%mod_num);  
  return 0;
}
0