Pell数列
You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.
【问题描述】
Pell数列a1,a2,a3,...的定义是这样的,a1=1,a2=2,...,an=2a+a(n>2)。
给出一个正整数k,要求Pell数列的第k项模上32767是多少。
【输入格式】
第1行是测试数据的组数n,后面跟着n行输入。每组测试数据占1行,包括一个正整数k (1≤k<1000000)。
【输出格式】
n行,每行输出对应一个输入。输出应是一个非负整数。
【样例数据】
2
1
8
1
408