ACM的一道题,看着很简单,提交却WA了,
题目
ACM的一道题,看着很简单,提交却WA了,
More than Fibonacci
Time Limit:1000ms
Memory Limit:65536kb
Description
The New Fibonacci numbers (0,1,2,3,6,11,20,37,68,...) are defined by the recurrence:F(0) = 0; F(1) = 1; F(2) = 2;
F(n) = F(n-1) + F(n-2) + F(n-3) for all n>2
Write a program to calculate the New Fibonacci numbers.
Input
The input is a sequence of integers not more than 36,each on a separate line,specifying which New Fibonacci number to calculate.
Output
Print the New Fibonacci numbers in the format shown in Sample Output.
Sample Input
5
7
11
Sample Output
The New Fibonacci number for 5 is 11
The New Fibonacci number for 7 is 37
The New Fibonacci number for 11 is 423
我的代码:
#include
main()
{
x05long F[37];
x05int i,n;
x05while(scanf("%d",&n)!=EOF)
x05{
x05x05F[0]=0;F[1]=1;F[2]=2;
x05x05for(i=3;i
答案
#include
int main()
{
long F[37];
int i,n;
F[0]=0;F[1]=1;F[2]=2;
for(i=3;i
举一反三
已知函数f(x)=x,g(x)=alnx,a∈R.若曲线y=f(x)与曲线y=g(x)相交,且在交点处有相同的切线,求a的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
最新试题
- 原子物理种经典理论的角量子数nΦ和量子力学的角量子数l的区别
- 求大神翻译:Management and unions have struck a bargain over wage increases.
- 重阳节,向明中学的师生到敬老院看望老人,他们共准备了320个苹果,240个桔子,200个梨,来慰问老人.
- 已知二次函数y=ax^2+bx+c(a>0)的图象与x轴交于A、B两点,且点A在点B的左边,与y轴交于点C,且过点M(-1,2),N(1,-2)
- 橡胶是有什么物质组成的?
- 2,3,4,6用+,-,*,/四则运算等于24,怎么算?
- 小明有5元和2元的纸币共18张,一共60元,两种人民币个有多少张?
- 设ln(x^2+y^2)^(1/2)=arctan(y/x),则y的导数为
- (wield the weight 往后)
- 有一支温度计刻度不准,将温度计放在冰水混合物中时的读数是2摄氏度,放在一标准气压下沸水102摄氏度,若放
热门考点