题解 | #数列#
数列
https://www.nowcoder.com/practice/1843c3b052984e3f98c68935ea3c0d79
#include <stdio.h> int main() { int arr[1000000] = { 0 }; arr[0] = 1; arr[1] = 2; for (int i = 2; i < 1000000; i++) { arr[i] = (arr[i - 1] * 2 + arr[i - 2]) % 32767; } int t, k; scanf("%d", &k); while (k--) { scanf("%d", &t); printf("%d\n", arr[t - 1]); } return 0; }