组合数学相关练习

组合数学相关练习

1.Count The Blocks

题目传送门:ECR 84 E
题意:给定n,求从0到 10^n-1 的所有长度为 i(i从1到n)的个数。每个数均为n位数(不足补前导0)

在这里插入图片描述在这里插入图片描述在这里插入图片描述

下面上代码

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5,mod=998244353;
ll f[N],n; 
int main(){
	cin>>n;
	f[0]=1;
	for(int i=1;i<=n;i++) f[i]=(f[i-1]*10)%mod;
	for(int i=1;i<n;i++) printf("%lld ",(18*f[n-i]+81*f[n-i-1]*(n-i-1))%mod);
	puts("10");
	return 0;
}

发布了18 篇原创文章 · 获赞 14 · 访问量 355

猜你喜欢

转载自blog.csdn.net/weixin_45750972/article/details/105066535