結果

問題 No.2141 Enumeratest
ユーザー CleyLCleyL
提出日時 2022-12-21 18:29:11
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 51 ms / 2,000 ms
コード長 591 bytes
コンパイル時間 556 ms
コンパイル使用メモリ 68,224 KB
実行使用メモリ 26,880 KB
最終ジャッジ日時 2024-04-29 03:22:47
合計ジャッジ時間 2,928 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 10 ms
8,832 KB
testcase_03 AC 46 ms
26,880 KB
testcase_04 AC 51 ms
26,880 KB
testcase_05 AC 7 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 5 ms
5,376 KB
testcase_08 AC 15 ms
11,904 KB
testcase_09 AC 10 ms
8,960 KB
testcase_10 AC 23 ms
16,768 KB
testcase_11 AC 41 ms
24,704 KB
testcase_12 AC 3 ms
5,376 KB
testcase_13 AC 10 ms
8,448 KB
testcase_14 AC 39 ms
24,448 KB
testcase_15 AC 23 ms
15,616 KB
testcase_16 AC 28 ms
18,688 KB
testcase_17 AC 27 ms
17,280 KB
testcase_18 AC 16 ms
9,856 KB
testcase_19 AC 35 ms
20,992 KB
testcase_20 AC 20 ms
13,056 KB
testcase_21 AC 21 ms
12,928 KB
testcase_22 AC 15 ms
9,600 KB
testcase_23 AC 12 ms
9,472 KB
testcase_24 AC 43 ms
25,600 KB
testcase_25 AC 14 ms
11,008 KB
testcase_26 AC 7 ms
5,376 KB
testcase_27 AC 18 ms
11,392 KB
testcase_28 AC 18 ms
10,240 KB
testcase_29 AC 11 ms
7,552 KB
testcase_30 AC 34 ms
19,584 KB
testcase_31 AC 24 ms
14,464 KB
testcase_32 AC 31 ms
18,688 KB
testcase_33 AC 20 ms
12,544 KB
testcase_34 AC 34 ms
21,504 KB
testcase_35 AC 3 ms
5,376 KB
testcase_36 AC 19 ms
11,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>


using namespace std;

const long long mod = 998244353;

long long fac[2000000];
long long inv[2000000];
long long finv[2000000];
void init(int n){
  fac[0] = fac[1] = 1;
  inv[1] = 1;
  finv[0] = finv[1] = 1;
  for(long long i = 2; n >= i; i++){
    fac[i] = (i*fac[i-1])%mod;
    inv[i] = ((mod-inv[mod%i]) * (mod/i))%mod;
    finv[i] = (finv[i-1]*inv[i])%mod;
  }
}


int main(){
  long long n,m;cin>>n>>m;
  init(m);
  long long ans = fac[m];
  for(int i = 0; n > i; i++){
    long long nw = m/n+((m%n)>i);
    ans = (ans*finv[nw])%mod;
  }
  cout << ans << endl;
}
0