Problem - 1327E - Codeforces
题目大意:对于给定的n,现在有大小为 [ 1 , 1 0 n − 1 ] [1, 10^n-1] [1,10n−1],对于长度不为 n n n,自动补全前置零,求最大连续长度分别为 1 , 2 , 3 , . . , n 1, 2, 3,..,n 1,2,3,..,n的有多少种。
暴力打表
然后发现从倒数第三项开始,每一项都是前面的一项加了81, 810, 8100,不断地累加之后乘10.
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define syncfalse ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
const int mod = 998244353;
const int N = 2e5+5;
ll ans[N];
int num[10];
int main(){
syncfalse
#ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
#endif
int n;
cin>>n;
ans[n]=10;
if (n>1)ans[n-1]=180;
ll now = 81;
for (int i = n-2; i >= 1; --i){
ans[i]=(ans[i+1]+now)*10%mod;
now=(now*10)%mod;
}
for (int i = 1; i <= n; ++i)cout << ans[i] << ' ';
return 0;
}