#include typedef long long ll; typedef unsigned long long ull; #define FOR(i,a,b) for(int (i)=(a);i<(b);i++) #define REP(i,n) FOR(i,0,n) #define RANGE(vec) (vec).begin(),(vec).end() using namespace std; class ModInt { long long value_; public: static long long Mod; static void set_mod(long long mod) { Mod= mod; } static long long get_mod(void) { return Mod; } ModInt() : value_(0) {} ModInt(long long val) { if (val >= Mod) value_ = val % Mod; else if (val >= 0) value_ = val; else // val < 0 value_ = (((-val)/Mod+1)*Mod+val) % Mod; assert(value_ < Mod); } ModInt(const ModInt &other) { value_ = other.value_; } ~ModInt() {} #define OPT(OP) \ ModInt operator OP (const ModInt &other) const { \ return ModInt(value_ OP other.value_); \ } \ template \ ModInt &operator OP##=(const T &other) { \ return (*this = (*this OP ModInt(other))); \ } OPT(+) OPT(-) OPT(*) #undef OPT bool operator==(const ModInt &other) const { return (value_ == other.value_); } bool operator!=(const ModInt &other) const { return !(*this == other); } ModInt &operator=(const ModInt &other) { value_ = other.value_; return *this; } // ModInt - int >= 0 みたいな比較は常に true になってしまうのでダメ (ModInt >= int は ok) // ModInt 間のみの比較にする bool operator<(const ModInt &other) const { return value_ < other.value_; } bool operator<=(const ModInt &other) const { return value_ <= other.value_; } bool operator>(const ModInt &other) const { return (other < *this); } bool operator>=(const ModInt &other) const { return (other <= *this); } // cast overload operator int() const { return value_; } operator long long() const { return value_; } static long long pow(ModInt a, int k) { ModInt b = 1; while (k > 0) { if (k & 1) b = (b*a); a = (a*a); k >>= 1; } return b; } // call when Mod is prime ModInt inv() { return ModInt::pow(*this, Mod-2); } long long value() const { return value_; } friend std::ostream& operator<<(std::ostream& os, const ModInt& m) { os< dp(MaxM+1, 0); dp[0] = 1; // 111111LL 未満の払い方は 1 通り // O(10*MaxM) <= 10^6 for (int j = 1; j <= 9; ++j) for (ll i = 0; i < MaxM; ++i) { if (i+j <= MaxM) dp[i+j] += dp[i]; } // dp2[i] := i 円までを 1~9 のコインで払う払い方 // // これは j 円までを (j < i) 1~9 のコインではらって残りを // 本来の 1 円コインで払うという払い方ができるから累積 DP が必要 // vector dp2(MaxM+1, 0); dp2[0] = 1; for (ll i = 1; i <= MaxM; ++i) dp2[i] = dp2[i-1] + dp[i]; int T; cin>>T; REP(i,T) { ll m; cin>>m; cout<solve(); delete obj; return 0; } #endif