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的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
最新试题
- 关于生物群落演替 (农田弃耕后,在自然状态下的演替是从一年生草本植物开始)这句话对不对啊?
- 坐地日行八万里,巡天遥看一千河.的意思
- 某拖拉机今年每月的上个月的产量提高的百分数相同,且2月份比1月份的产量多100台,3月份比2月份的产量多
- 黎明的近义词是什么,反义 词是什么.寂静的反义词是什么.凊亮的近、反义词.
- 为什么lg5*lg20=lg5*(1+lg2)
- 有5筐重量相当的鸡蛋,如果从每筐中取出10千克,5个筐里剩下的鸡蛋重量正好等于原来2筐的重量.
- abcdef六种物质,a固体,b液体,cdef气体,它们之间有下列转变关系,a+d=e,c+d=e,e+a=c,b通电=d+f,
- 拖鞋售价是10元,一双凉鞋的售价比一双拖鞋高90%,正好是一双皮鞋售价的20%.一双皮鞋的售价是多少元?
- 解释下列词语的意思并造句
- 你是广袤的大地,是辽阔的天空;你是丛山峻岭,是江海湖泊.仿句练习
热门考点
- going you what see to are opera(?)连词成句
- 在元旦联欢晚会上,被誉为魔术师的晓慧同学为同学们表演了一组魔术,在三支盛有无色液体的玻璃杯中,分别
- 明天就交作业啦,快
- warm-up-activity是什么意思
- take down=put of吗
- 质量相同的实心铜球和铁球投入同种液体后所受浮力大小相等,这种液体一定是( ) A.水 B.水银 C.酒精 D.盐水
- who is that boy,()is lee,that;this;it;he
- lightning-fast是什么意思
- 请求道数学题:1—11这11个数字里,每五个数分一组,可以分多少组?
- 一个长方形场地,长是宽的2.5倍,现将这个长方形的场地进行扩建,若长和宽各加20米,则长为宽2倍