Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 4133 Accepted Submission(s): 1547
1 #include <stdio.h> 2 #include <string.h> 3 int fei[220][1001]; 4 int main() 5 { 6 int n; 7 char str[220]; 8 int i, j; 9 int temp, plus = 0; 10 memset(fei, 0, sizeof(fei)); 11 fei[1][0] = 1; 12 fei[2][0] = 2; 13 for(i=3; i<201; i++) 14 { 15 for(j=0; j<1001; j++) //二维数组下标表示数的位数; 16 { 17 temp = fei[i-1][j] + fei[i-2][j] + plus; 18 fei[i][j] = temp%10; 19 plus = temp/10; 20 } 21 } 22 scanf("%d", &n); 23 while(n--) 24 { 25 scanf("%s", str); 26 int len = strlen(str); 27 for(i=1000; i>=0; i--) 28 if(fei[len][i]) 29 break; 30 for(; i>=0; i--) 31 printf("%d", fei[len][i]); 32 printf("\n"); 33 } 34 return 0; 35 }