Educational Codeforces Round 84 (Rated for Div. 2) E. Count The Blocks(组合数学)

题目链接
在这里插入图片描述

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod= 998244353;
ll quick(ll a,ll b){ 
    ll ans=1;  
    a=a%mod;
    while(b!=0){
        if(b&1) ans=(ans*a)%mod;
        b>>=1;
        a=(a*a)%mod;
    }
    return ans;
}
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
	{
		ll ans=0;
		if(i==n) ans=10;
		if(i<n) ans=(ans+10*18*quick(10,n-i-1)%mod+mod)%mod;
		if(i<n-1) ans=(ans+10*81*(n-i-1)*quick(10,n-i-2)%mod+mod)%mod;
		printf("%lld ",ans);
	}
}
发布了328 篇原创文章 · 获赞 1 · 访问量 9085

猜你喜欢

转载自blog.csdn.net/qq_42479630/article/details/105256257