Given the size of n from 000...(n) to 999...(n)
, there are several consecutive equal numbers.
For example, 00027734000 has one size block is 3 and two sizes are 1. Two for all three
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod = 998244353;
const int maxn = 2e5+7;
ll quickpow(ll a,ll b)
{
ll res = 1;
a = a%mod;
while(b>0)
{
if(b & 1)
res = (a*res)%mod;
a = (a * a)%mod;
b >>= 1;
}
return res;
}
ll ans[maxn];
int main()
{
ll n;
scanf("%lld",&n);
ans[n] = 10,ans[n-1] = 180;
for(int i = 1;i <= n-2;i ++)
{
ll tmp = (ll)(n-i);
ans[i] = ((tmp-1)*810*quickpow((ll)10,tmp-2)%mod)%mod;// 这是不贴边的情况
ans[i] = (ans[i]%mod + (180*quickpow((ll)10,tmp-1)%mod))%mod;
ans[i]%=mod;
}
for(int i = 1;i <= n;i ++)
printf(i == n?"%lld\n":"%lld ",ans[i]);
return 0;
}