线性递推式(CCF201809-05)

样例输入

3 3 6
2 0 4

样例输出

12
32
80
208

样例说明

线性递推式(CCF201809-05)

样例输入

2 1 11
1 1

样例输出

1
2
3
5
8
13
21
34
55
89
144

样例说明

线性递推式(CCF201809-05)

样例输入

10 10 20
532737790 634932889 335818534 101179174 977780682 695192541 779962395 295668292 157661238 325351676

样例输出

119744921
651421717
601080475
163399777
291546699
108479226
406175654
344671679
459752012
489415425
349454810

数据规模和约定

线性递推式(CCF201809-05)

 

#include <iostream>

/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
 
int main(int argc, char *argv[]) 
{
	long int m;
	unsigned long long  int a[100010];
	unsigned long long  int r,l,k[100010];
	cin>>m>>r>>l;
	a[0]=1;
	for(long int i=1;i<=m;i++)
		cin>>k[i];
	for(long int i=1;i<m;i++)
		for(int j=0;j<i;j++)
		{
			a[i]=( (a[i]+k[i-j]*a[j]))%998244353;
		}
		
	for(int i=m;i<l+1;i++)
	{
		for(int j=1;j<=m;j++)
		{
			a[i]=((a[i]+k[j]*a[i-j]))%998244353;
		}	
	}
	for(int i=r;i<l+1;i++)
	if(i!=l)
		cout<<(a[i])<<endl;
		cout<<(a[l]);
	
	return 0;
}

 

相关文章: