#include #ifdef _MSC_VER # include #else # include #endif #include #include namespace suisen { template using constraints_t = std::enable_if_t, std::nullptr_t>; template constexpr decltype(auto) constexpr_if(Then&& then, OrElse&& or_else) { if constexpr (cond_v) return std::forward(then); else return std::forward(or_else); } // ! function template using is_same_as_invoke_result = std::is_same, ReturnType>; template using is_uni_op = is_same_as_invoke_result; template using is_bin_op = is_same_as_invoke_result; template using is_comparator = std::is_same, bool>; // ! integral template >> constexpr int bit_num = std::numeric_limits>::digits; template struct is_nbit { static constexpr bool value = bit_num == n; }; template static constexpr bool is_nbit_v = is_nbit::value; // ? template struct safely_multipliable {}; template <> struct safely_multipliable { using type = long long; }; template <> struct safely_multipliable { using type = __int128_t; }; template <> struct safely_multipliable { using type = unsigned long long; }; template <> struct safely_multipliable { using type = __uint128_t; }; template <> struct safely_multipliable { using type = __uint128_t; }; template <> struct safely_multipliable { using type = float; }; template <> struct safely_multipliable { using type = double; }; template <> struct safely_multipliable { using type = long double; }; template using safely_multipliable_t = typename safely_multipliable::type; template struct rec_value_type { using type = T; }; template struct rec_value_type> { using type = typename rec_value_type::type; }; template using rec_value_type_t = typename rec_value_type::type; template class is_iterable { template static auto test(T_ e) -> decltype(e.begin(), e.end(), std::true_type{}); static std::false_type test(...); public: static constexpr bool value = decltype(test(std::declval()))::value; }; template static constexpr bool is_iterable_v = is_iterable::value; template class is_writable { template static auto test(T_ e) -> decltype(std::declval() << e, std::true_type{}); static std::false_type test(...); public: static constexpr bool value = decltype(test(std::declval()))::value; }; template static constexpr bool is_writable_v = is_writable::value; template class is_readable { template static auto test(T_ e) -> decltype(std::declval() >> e, std::true_type{}); static std::false_type test(...); public: static constexpr bool value = decltype(test(std::declval()))::value; }; template static constexpr bool is_readable_v = is_readable::value; } // namespace suisen namespace suisen { // ! type aliases using int128 = __int128_t; using uint128 = __uint128_t; template using priority_queue_greater = std::priority_queue, std::greater>; } // ! macros (internal) #define DETAIL_CAT_I(a, b) a##b #define DETAIL_CAT(a, b) DETAIL_CAT_I(a, b) #define DETAIL_UNIQVAR(tag) DETAIL_CAT(tag, __LINE__) // ! macros #define FOR(e, v) for (auto &&e : v) #define CFOR(e, v) for (const auto &e : v) #define REP(i, ...) for (auto &&i : suisen::macro::rep_impl(__VA_ARGS__)) #define RREP(i, ...) for (auto &&i : suisen::macro::rrep_impl(__VA_ARGS__)) #define REPINF(i, ...) for (auto &&i : suisen::macro::repinf_impl(__VA_ARGS__)) #define CREP(i, ...) for (const auto &i : suisen::macro::rep_impl(__VA_ARGS__)) #define CRREP(i, ...) for (const auto &i : suisen::macro::rrep_impl(__VA_ARGS__)) #define CREPINF(i, ...) for (const auto &i : suisen::macro::repinf_impl(__VA_ARGS__)) #define LOOP(n) for ([[maybe_unused]] const auto& DETAIL_UNIQVAR(loop_variable) : suisen::macro::rep_impl(n)) #define ALL(iterable) std::begin(iterable), std::end(iterable) #define INPUT(type, ...) type __VA_ARGS__; read(__VA_ARGS__) // ! string / container namespace suisen { __int128_t stoi128(const std::string& s) { __int128_t ret = 0; for (int i = 0; i < int(s.size()); i++) if ('0' <= s[i] and s[i] <= '9') ret = 10 * ret + s[i] - '0'; if (s[0] == '-') ret = -ret; return ret; } __uint128_t stou128(const std::string& s) { __uint128_t ret = 0; for (int i = 0; i < int(s.size()); i++) if ('0' <= s[i] and s[i] <= '9') ret = 10 * ret + s[i] - '0'; return ret; } template , std::nullptr_t> = nullptr> std::string join(const Iterable& v, const std::string& sep, const std::string& end) { std::ostringstream ss; for (auto it = v.begin(); it != v.end();) { ss << *it; if (++it != v.end()) ss << sep; } ss << end; return ss.str(); } template , std::nullptr_t> = nullptr> std::vector split(const Iterable s, typename Iterable::value_type delim) { std::vector res; for (auto itl = std::begin(s), itr = itl;; itl = ++itr) { while (itr != std::end(s) and *itr != delim) ++itr; res.emplace_back(itl, itr); if (itr == std::end(s)) return res; } } template , std::nullptr_t> = nullptr> void concat(Iterable& s, const Iterable& t) { s.reserve(std::size(s) + std::size(t)); std::copy(std::begin(t), std::end(t), std::back_inserter(s)); } template , std::nullptr_t> = nullptr> Iterable concatenated(Iterable s, const Iterable& t) { concat(s, t); return s; } template , std::nullptr_t> = nullptr> auto mapped_vec(const Func& f, const Iterable& s) { std::vector> v; v.reserve(std::size(s)), std::transform(std::begin(s), std::end(s), std::back_inserter(v), f); return v; } template , std::nullptr_t> = nullptr> auto copied_vec(const Iterable& s) { std::vector v; v.reserve(std::size(s)), std::copy(std::begin(s), std::end(s), std::back_inserter(v)); return v; } namespace charmap { int fd(char c) { return c - '0'; } int fa(char c) { return c - 'a'; } int fA(char c) { return c - 'A'; } int faA(char c) { return c <= 'Z' ? c - 'A' : 26 + (c - 'a'); } } template , std::nullptr_t> = nullptr> std::string bin(T val, int bit_num = -1) { std::string res; if (bit_num != -1) { for (int bit = bit_num; bit-- > 0;) res += '0' + ((val >> bit) & 1); } else { for (; val; val >>= 1) res += '0' + (val & 1); std::reverse(res.begin(), res.end()); } return res; } template , std::is_integral>, std::nullptr_t> = nullptr> std::vector digits_low_to_high(T val, U base = 10) { std::vector res; for (; val; val /= base) res.push_back(val % base); if (res.empty()) res.push_back(T{ 0 }); return res; } template , std::is_integral>, std::nullptr_t> = nullptr> std::vector digits_high_to_low(T val, U base = 10) { auto res = digits_low_to_high(val, base); std::reverse(res.begin(), res.end()); return res; } template , std::enable_if_t, std::is_invocable_r, std::invoke_result_t>>, std::nullptr_t> = nullptr> auto comparator(const ToKey& to_key, const CompareValue& compare_value = std::less<>()) { return [to_key, compare_value](const T& x, const T& y) { return compare_value(to_key(x), to_key(y)); }; } template , std::nullptr_t> = nullptr> std::vector sorted_indices(int n, const ToKey& to_key) { std::vector p(n); std::iota(p.begin(), p.end(), 0); std::sort(p.begin(), p.end(), comparator(to_key)); return p; } template , std::nullptr_t> = nullptr> std::vector sorted_indices(int n, const Compare& compare) { std::vector p(n); std::iota(p.begin(), p.end(), 0); std::sort(p.begin(), p.end(), compare); return p; } template auto priority_queue_with_comparator(const Comparator comparator) { return std::priority_queue, Comparator>(comparator); } template , std::nullptr_t> = nullptr> void sort_unique_erase(Iterable& a) { std::sort(a.begin(), a.end()), a.erase(std::unique(a.begin(), a.end()), a.end()); } } // ! IO namespace suisen::io { namespace details { template void print_single(std::ostream&, const T&); void print(std::ostream& os, __int128_t value) { std::ostream::sentry s(os); if (s) { __uint128_t tmp = value < 0 ? -value : value; char buffer[128]; char* d = std::end(buffer); do { --d; *d = "0123456789"[tmp % 10]; tmp /= 10; } while (tmp != 0); if (value < 0) { --d; *d = '-'; } int len = std::end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(std::ios_base::badbit); } } } void print(std::ostream& os, __uint128_t value) { std::ostream::sentry s(os); if (s) { char buffer[128]; char* d = std::end(buffer); do { --d; *d = "0123456789"[value % 10]; value /= 10; } while (value != 0); int len = std::end(buffer) - d; if (os.rdbuf()->sputn(d, len) != len) { os.setstate(std::ios_base::badbit); } } } template void print(std::ostream& os, const std::pair& a) { print_single(os, a.first), print_single(os, ' '), print_single(os, a.second); } template void print(std::ostream& os, const std::tuple& a) { if constexpr (N == std::tuple_size_v>) return; else { if constexpr (N) print_single(os, ' '); print_single(os, std::get(a)); print(os, a); } } template , std::negation>>, std::nullptr_t> = nullptr> void print(std::ostream& os, const Iterable& a) { for (auto it = a.begin(); it != a.end();) { print_single(os, *it); if (++it != a.end()) print_single(os, ' '); } } template void print_single(std::ostream& os, const T& e) { if constexpr (suisen::is_writable_v) os << e; else details::print(os, e); } } void print() { std::cout << '\n'; } template void print(const Head& head, const Tail &...tails) { details::print_single(std::cout, head); if constexpr (sizeof...(Tail)) details::print_single(std::cout, ' '); print(tails...); } template , std::nullptr_t> = nullptr> void print_all(const Iterable& v, std::string sep = " ", std::string end = "\n") { for (auto it = v.begin(); it != v.end();) { details::print_single(std::cout, *it); if (++it != v.end()) details::print_single(std::cout, sep); } details::print_single(std::cout, end); } namespace details { template void read_single(std::istream&, T&); void read(std::istream& is, __int128_t& v) { std::string s; is >> s; v = stoi128(s); } void read(std::istream& is, __uint128_t& v) { std::string s; is >> s; v = stou128(s); } template void read(std::istream& is, std::pair& a) { read_single(is, a.first), read_single(is, a.second); } template void read(std::istream& is, std::tuple& a) { if constexpr (N < sizeof...(Args)) read_single(is, std::get(a)), read(is, a); } template , std::negation>>, std::nullptr_t> = nullptr> void read(std::istream& is, Iterable& a) { for (auto it = a.begin(); it != a.end(); ++it) read_single(is, *it); } template void read_single(std::istream& is, T& e) { if constexpr (suisen::is_readable_v) is >> e; else details::read(is, e); } struct { template operator T() const { T e; read_single(std::cin, e); return e; } } constexpr reader; } auto read() { return details::reader; } template void read(Head& head, Tail &...tails) { details::read_single(std::cin, head); if constexpr (sizeof...(Tail)) read(tails...); } } namespace suisen { using io::print, io::print_all, io::read; } // ! numeric namespace suisen { // x <- min(x, y). returns true iff `x` has chenged. template bool chmin(T& x, const T& y) { return y >= x ? false : (x = y, true); } // x <- max(x, y). returns true iff `x` has chenged. template bool chmax(T& x, const T& y) { return y <= x ? false : (x = y, true); } // Returns pow(-1, n) template constexpr int pow_m1(T n) { return -(n & 1) | 1; } // Returns pow(-1, n) template <> constexpr int pow_m1(bool n) { return -int(n) | 1; } // Returns floor(x / y) template constexpr T fld(const T x, const T y) { T q = x / y, r = x % y; return q - ((x ^ y) < 0 and (r != 0)); } template constexpr T cld(const T x, const T y) { T q = x / y, r = x % y; return q + ((x ^ y) > 0 and (r != 0)); } } // ! bit namespace suisen { template >, std::nullptr_t> = nullptr> __attribute__((target("popcnt"))) constexpr int popcount(const T x) { return _mm_popcnt_u32(x); } template , std::nullptr_t> = nullptr> __attribute__((target("popcnt"))) constexpr int popcount(const T x) { return _mm_popcnt_u64(x); } template >, std::nullptr_t> = nullptr> constexpr int count_lz(const T x) { return x ? __builtin_clz(x) : suisen::bit_num; } template , std::nullptr_t> = nullptr> constexpr int count_lz(const T x) { return x ? __builtin_clzll(x) : suisen::bit_num; } template >, std::nullptr_t> = nullptr> constexpr int count_tz(const T x) { return x ? __builtin_ctz(x) : suisen::bit_num; } template , std::nullptr_t> = nullptr> constexpr int count_tz(const T x) { return x ? __builtin_ctzll(x) : suisen::bit_num; } template constexpr int floor_log2(const T x) { return suisen::bit_num -1 - count_lz(x); } template constexpr int ceil_log2(const T x) { return floor_log2(x) + ((x & -x) != x); } template constexpr int kth_bit(const T x, const unsigned int k) { return (x >> k) & 1; } template constexpr int parity(const T x) { return popcount(x) & 1; } } // ! for macro namespace suisen::macro { template struct rep_impl { rep_impl(IntR n) : rep_impl(0, n, 1) {} rep_impl(IntL l, IntR r, IntStep step = 1) : _begin(l, step), _end(r) {} auto begin() const { return _begin; } auto end() const { return _end; } private: struct iterator { IntR val, step; iterator(const IntR& val, const IntR& step) : val(val), step(step) {} IntR& operator*() { return val; } bool operator!=(const IntR& endval) { return val < endval; } iterator& operator++() { return val += step, *this; } }; iterator _begin; IntR _end; }; template struct rrep_impl { rrep_impl(IntR n) : rrep_impl(0, n, 1) {} rrep_impl(IntL l, IntR r, IntStep step = 1) : _begin(l + fld(r - l - 1, step) * step, step), _end(l) {} auto begin() const { return _begin; } auto end() const { return _end; } private: struct iterator { IntR val, step; iterator(const IntR& val, const IntR& step) : val(val), step(step) {} IntR& operator*() { return val; } bool operator!=(const IntR& endval) { return val >= endval; } iterator& operator++() { return val -= step, *this; } }; iterator _begin; IntR _end; }; template struct repinf_impl { repinf_impl(IntL l, IntStep step = 1) : _begin(l, step) {} auto begin() const { return _begin; } auto end() const { return nullptr; } private: struct iterator { IntL val, step; iterator(const IntL& val, const IntL& step) : val(val), step(step) {} IntL& operator*() { return val; } bool operator!=(std::nullptr_t) { return true; } iterator& operator++() { return val += step, *this; } }; iterator _begin; }; } // ! misc namespace suisen { const std::string Yes = "Yes", No = "No", YES = "YES", NO = "NO"; } // ! debug #ifdef LOCAL # define debug(...) suisen::debug_internal(#__VA_ARGS__, __VA_ARGS__) namespace suisen { template void debug_internal(const char* s, T&& first, Args&&... args) { constexpr const char* prefix = "[\033[32mDEBUG\033[m] "; constexpr const char* open_brakets = sizeof...(args) == 0 ? "" : "("; constexpr const char* close_brakets = sizeof...(args) == 0 ? "" : ")"; std::cerr << prefix << open_brakets << s << close_brakets << ": " << open_brakets << std::forward(first); ((std::cerr << ", " << std::forward(args)), ...); std::cerr << close_brakets << "\n"; } } #else # define debug(...) void(0) #endif namespace suisen {} using namespace suisen; using namespace std; struct io_setup { io_setup(int precision = 20) { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); std::cout << std::fixed << std::setprecision(precision); } } io_setup_ {}; // ! code from here constexpr int iinf = std::numeric_limits::max() / 2; constexpr long long linf = std::numeric_limits::max() / 2; #include using mint = atcoder::modint998244353; namespace atcoder { std::istream& operator>>(std::istream& in, mint &a) { long long e; in >> e; a = e; return in; } std::ostream& operator<<(std::ostream& out, const mint &a) { out << a.val(); return out; } } // namespace atcoder #include #include namespace suisen { template struct factorial { factorial() = default; factorial(int n) { ensure(n); } static void ensure(const int n) { int sz = _fac.size(); if (n + 1 <= sz) return; int new_size = std::max(n + 1, sz * 2); _fac.resize(new_size), _fac_inv.resize(new_size); for (int i = sz; i < new_size; ++i) _fac[i] = _fac[i - 1] * i; _fac_inv[new_size - 1] = U(1) / _fac[new_size - 1]; for (int i = new_size - 1; i > sz; --i) _fac_inv[i - 1] = _fac_inv[i] * i; } T fac(const int i) { ensure(i); return _fac[i]; } T operator()(int i) { return fac(i); } U fac_inv(const int i) { ensure(i); return _fac_inv[i]; } U binom(const int n, const int r) { if (n < 0 or r < 0 or n < r) return 0; ensure(n); return _fac[n] * _fac_inv[r] * _fac_inv[n - r]; } U perm(const int n, const int r) { if (n < 0 or r < 0 or n < r) return 0; ensure(n); return _fac[n] * _fac_inv[n - r]; } private: static std::vector _fac; static std::vector _fac_inv; }; template std::vector factorial::_fac{ 1 }; template std::vector factorial::_fac_inv{ 1 }; } // namespace suisen void solve() { int n; read(n); factorial fac(n); REP(i, n + 1) { print(mint(-i).pow(n - i) * fac.fac_inv(n - i)); } } int main() { int test_case_num = 1; // read(test_case_num); LOOP(test_case_num) solve(); return 0; }