結果

問題 No.2141 Enumeratest
ユーザー US_cubeUS_cube
提出日時 2022-12-02 21:30:46
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 155 ms / 2,000 ms
コード長 3,113 bytes
コンパイル時間 963 ms
コンパイル使用メモリ 96,000 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-18 05:14:36
合計ジャッジ時間 4,034 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 7 ms
6,944 KB
testcase_03 AC 11 ms
6,940 KB
testcase_04 AC 155 ms
6,940 KB
testcase_05 AC 151 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 3 ms
6,940 KB
testcase_08 AC 4 ms
6,940 KB
testcase_09 AC 3 ms
6,944 KB
testcase_10 AC 5 ms
6,940 KB
testcase_11 AC 7 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 4 ms
6,940 KB
testcase_14 AC 6 ms
6,940 KB
testcase_15 AC 5 ms
6,940 KB
testcase_16 AC 6 ms
6,940 KB
testcase_17 AC 96 ms
6,944 KB
testcase_18 AC 123 ms
6,940 KB
testcase_19 AC 132 ms
6,940 KB
testcase_20 AC 107 ms
6,944 KB
testcase_21 AC 120 ms
6,940 KB
testcase_22 AC 87 ms
6,940 KB
testcase_23 AC 42 ms
6,944 KB
testcase_24 AC 36 ms
6,940 KB
testcase_25 AC 5 ms
6,940 KB
testcase_26 AC 137 ms
6,944 KB
testcase_27 AC 117 ms
6,944 KB
testcase_28 AC 146 ms
6,940 KB
testcase_29 AC 78 ms
6,940 KB
testcase_30 AC 136 ms
6,940 KB
testcase_31 AC 95 ms
6,944 KB
testcase_32 AC 105 ms
6,940 KB
testcase_33 AC 89 ms
6,944 KB
testcase_34 AC 86 ms
6,940 KB
testcase_35 AC 10 ms
6,940 KB
testcase_36 AC 138 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <climits>
#include <functional>
#include <cassert>
#include <numeric>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define per(i, n) for(int i = (n) - 1; i >= 0; i--)
using ll = long long;
#define vi vector<int>
#define vvi vector<vi>
#define vl vector<ll>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
constexpr int mod = 998244353;
using namespace std;
template<class T, class U>
bool chmax(T &a, const U &b){ return a < b ? (a = b, 1) : 0; }
template<class T, class U>
bool chmin(T &a, const U &b){ return a > b ? (a = b, 1) : 0; }
template <int mod>
struct Mint {
  ll x;
  constexpr Mint(ll x = 0) : x((x + mod) % mod){}
  static constexpr int get_mod(){ return mod; }
  constexpr Mint operator-() const{ return Mint(-x); }
  constexpr Mint operator+=(const Mint &a){
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  constexpr Mint &operator++(){
    if(++x == mod) x = 0;
    return *this;
  }
  constexpr Mint operator++(int){
    Mint temp = *this;
    if(++x == mod) x = 0;
    return temp;
  }
  constexpr Mint &operator-=(const Mint &a){
    if((x -= a.x) < 0) x += mod;
    return *this;
  }
  constexpr Mint &operator--(){
    if(--x < 0) x += mod;
    return *this;
  }
  constexpr Mint operator--(int){
    Mint temp = *this;
    if(--x < 0) x += mod;
    return temp;
  }
  constexpr Mint &operator*=(const Mint &a){
    (x *= a.x) %= mod;
    return *this;
  }
  constexpr Mint operator+(const Mint &a) const{ return Mint(*this) += a; }
  constexpr Mint operator-(const Mint &a) const{ return Mint(*this) -= a; }
  constexpr Mint operator*(const Mint &a) const{ return Mint(*this) *= a; }
  constexpr Mint pow(ll t) const{
    if(!t) return 1;
    Mint res = 1, v = *this;
    while(t){
      if(t & 1) res *= v;
      v *= v;
      t >>= 1;
    }
    return res;
  }
  constexpr Mint inv() const{ return pow(mod - 2); }
  constexpr Mint &operator/=(const Mint &a){ return (*this) *= a.inv(); }
  constexpr Mint operator/(const Mint &a) const{ return Mint(*this) /= a; }
  constexpr bool operator==(const Mint &a) const{ return x == a.x; }
  constexpr bool operator!=(const Mint &a) const{ return x != a.x; }
  constexpr bool operator<(const Mint &a) const{ return x < a.x; }
  constexpr bool operator>(const Mint &a) const{ return x > a.x; }
  friend istream &operator>>(istream &is, Mint &a){ return is >> a.x; }
  friend ostream &operator<<(ostream &os, const Mint &a){ return os << a.x; }
};
using mint = Mint<mod>;
int main(){
  int n,m;
  cin >> n >> m;
  mint ans = 1;
  rep(i, m) ans *= i+1;
  const int v = m / n;
  mint val = 1;
  rep(i, v) val *= i+1;
  rep(i, m % n) ans /= val * (v+1);
  rep(i, n - m % n) ans /= val;
  cout << ans << "\n";
}
0