标签:斐波那契
链接:click here
题意:
3 1 2 3
2 3 5
代码:
#include <stdio.h>
int main()
{
int i;
int a[15010];
a[0]=0,a[1]=2,a[2]=3;
for(i=3;i<15010;i++)
a[i]=(a[i-1]+a[i-2])%10000;
int n;
scanf("%d",&n);
while(n--)
{
int m;
scanf("%d",&m);
printf("%d\n",a[m%15000]%10000);
}
return 0;
}
When you want to give up, think of why you persist until now!NYOJ 698 A Coin Problem (斐波那契)
标签:斐波那契
原文地址:http://blog.csdn.net/u013050857/article/details/43919257