题目:https://www.nowcoder.com/pat/2/problem/257
1 #include <iostream> 2 #include <stdio.h> 3 4 using namespace std; 5 6 long long diff[103] = { 1, 1, 2 }; 7 //斐波那契数到103项就会超过2^64 8 9 int main() 10 { 11 for (int i = 3; i<103; i++) { 12 diff[i] = diff[i - 1] + diff[i - 2]; 13 } 14 unsigned int n; unsigned int a, b, d; 15 scanf("%d", &n); 16 while (n--) { 17 scanf("%d %d", &a, &b); d = b - a; 18 printf("%lld\n", diff[d]); 19 } 20 return 0; 21 }