标签:
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 58392 Accepted Submission(s):
21093
注意用long long 而不是int 。int 会溢出
#include <iostream> #include <stdlib.h> #include <stdio.h> using namespace std; long long a[10005]; int main() { int i,n,m,t; a[1]=1; a[2]=2; for(i=3;i<=10005;i++) a[i]=a[i-1]+a[i-2]; cin>>t; while(t--) { cin>>n>>m; cout<<a[m-n]<<endl; } return 0; }
标签:
原文地址:http://www.cnblogs.com/Ritchie/p/5425350.html