题目:https://www.nowcoder.com/pat/2/problem/254
1 #include <iostream> 2 #include <algorithm> 3 #include <stdio.h> 4 using namespace std; 5 const int maxn = 105; 6 int f[10005]; 7 int x[maxn]; 8 9 void db(){ 10 int a, b, c, d; 11 int a1, b1, c1, d1; 12 a = b = c = 1; 13 d = 0; 14 f[0] = 1; 15 f[1] = 1; 16 for (int i = 2; i < 10005; i++){ 17 f[i] = (f[i - 1] + f[i - 2]) % 10000; 18 } 19 20 } 21 22 int main(){ 23 // std::ios::sync_with_stdio(false); 24 int n; 25 db(); 26 while (~scanf("%d",&n)) 27 { 28 for (int i = 0; i < n; i++){ 29 scanf("%d", &x[i]); 30 } 31 for (int i = 0; i < n; i++){ 32 printf("%04d", f[x[i]]); 33 } 34 printf("\n"); 35 } 36 //system("pause"); 37 return 0; 38 }