結果
問題 | No.2857 Div Array |
ユーザー | dyktr_06 |
提出日時 | 2024-05-09 22:35:33 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 3,502 bytes |
コンパイル時間 | 1,921 ms |
コンパイル使用メモリ | 200,596 KB |
実行使用メモリ | 16,512 KB |
最終ジャッジ日時 | 2024-05-09 22:35:40 |
合計ジャッジ時間 | 6,136 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 7 ms
16,512 KB |
testcase_01 | AC | 7 ms
11,136 KB |
testcase_02 | AC | 7 ms
11,136 KB |
testcase_03 | AC | 7 ms
11,136 KB |
testcase_04 | AC | 7 ms
11,136 KB |
testcase_05 | AC | 7 ms
11,136 KB |
testcase_06 | AC | 7 ms
11,264 KB |
testcase_07 | AC | 7 ms
11,136 KB |
testcase_08 | AC | 7 ms
11,136 KB |
testcase_09 | AC | 8 ms
11,264 KB |
testcase_10 | RE | - |
testcase_11 | TLE | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
ソースコード
#include <bits/stdc++.h> using namespace std; template <long long Modulus> struct ModInt{ long long val; constexpr ModInt(const long long _val = 0) noexcept : val(_val) { normalize(); } void normalize(){ val = (val % Modulus + Modulus) % Modulus; } inline ModInt &operator+=(const ModInt &rhs) noexcept { if(val += rhs.val, val >= Modulus) val -= Modulus; return *this; } inline ModInt &operator-=(const ModInt &rhs) noexcept { if(val -= rhs.val, val < 0) val += Modulus; return *this; } inline ModInt &operator*=(const ModInt &rhs) noexcept { val = val * rhs.val % Modulus; return *this; } inline ModInt &operator/=(const ModInt &rhs) noexcept { val = val * inv(rhs.val).val % Modulus; return *this; } inline ModInt &operator++() noexcept { if(++val >= Modulus) val -= Modulus; return *this; } inline ModInt operator++(int) noexcept { ModInt t = val; if(++val >= Modulus) val -= Modulus; return t; } inline ModInt &operator--() noexcept { if(--val < 0) val += Modulus; return *this; } inline ModInt operator--(int) noexcept { ModInt t = val; if(--val < 0) val += Modulus; return t; } inline ModInt operator-() const noexcept { return (Modulus - val) % Modulus; } inline ModInt inv(void) const { return inv(val); } ModInt pow(long long n){ assert(0 <= n); ModInt x = *this, r = 1; while(n){ if(n & 1) r *= x; x *= x; n >>= 1; } return r; } ModInt inv(const long long n) const { long long a = n, b = Modulus, u = 1, v = 0; while(b){ long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= Modulus; if(u < 0) u += Modulus; return u; } friend inline ModInt operator+(const ModInt &lhs, const ModInt &rhs) noexcept { return ModInt(lhs) += rhs; } friend inline ModInt operator-(const ModInt &lhs, const ModInt &rhs) noexcept { return ModInt(lhs) -= rhs; } friend inline ModInt operator*(const ModInt &lhs, const ModInt &rhs) noexcept { return ModInt(lhs) *= rhs; } friend inline ModInt operator/(const ModInt &lhs, const ModInt &rhs) noexcept { return ModInt(lhs) /= rhs; } friend inline bool operator==(const ModInt &lhs, const ModInt &rhs) noexcept { return lhs.val == rhs.val; } friend inline bool operator!=(const ModInt &lhs, const ModInt &rhs) noexcept { return lhs.val != rhs.val; } friend inline istream &operator>>(istream &is, ModInt &x) noexcept { is >> x.val; x.normalize(); return is; } friend inline ostream &operator<<(ostream &os, const ModInt &x) noexcept { return os << x.val; } }; using mint = ModInt<998244353>; mint dp[1001][1001]; int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); long long n, m, k; cin >> n >> m >> k; for(int i = 1; i <= m; i++){ dp[1][m / i] += 1; } for(int i = 1; i < n; i++){ for(int j = 1; j <= m; j++){ for(int l = 1; l <= m; l++){ if(abs(m / l - j) <= k){ dp[i + 1][m / l] += dp[i][j]; } } } } mint ans = 0; for(int i = 1; i <= m; i++){ ans += dp[n][i]; } cout << ans << "\n"; }