题目
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
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
提问时间:2021-04-01
答案
#include
int main()
{
long F[37];
int i,n;
F[0]=0;F[1]=1;F[2]=2;
for(i=3;i
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的值和该切线方程.
我想写一篇关于奥巴马的演讲的文章,写哪一篇好呢?为什么好
奥巴马演讲不用看稿子.为什么中国领导演讲要看?
想找英语初三上学期的首字母填空练习……
英语翻译
最新试题
热门考点
- 1图书馆借出504本图书后又进了420本图书,如果现有1000本图书,原来有多少本图书?如果原有722本图书,现在
- 2请问any other 后面接名词单数还是复数.请给些例子,
- 3铝三角和铁三角的化学方程式和离子方程式!
- 4you can listen to them at home and repeat the sentence that are difficult for you.
- 5文中写子贡做了什么事?孔子对他的做法持什么态度?孔子持这种态度的理由是什么?
- 65.4元等于多少分,
- 7∫arctan(x/(1+x))^-2
- 815x除4等于1.4,方程的解
- 918分之5除以10等于多少?
- 10Our classroom is big and clean.否定句怎么改?