百练 2786 Pell数列

题目链接:http://bailian.openjudge.cn/practice/2786

# include 
int main()
{
	int a[10000],t,i;
	a[0]=1,a[1]=2;
	for(i=2;i<150;i++)
	{
		a[i]=2*a[i-1]+a[i-2];
		a[i]%=32767;
	}
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d",&i);
		printf("%d\n",a[i%150-1]);
	}
	return 0;
}



你可能感兴趣的:(百练题解)