1147: 零起点学算法54——Fibonacc
1147: 零起点学算法54——Fibonacc
Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lld
Submitted: 2097 Accepted: 863
[Submit][Status][Web Board]
Description
Fibonacci数列定义为(1,1,2,3,5,8,.....),即每个元素是前两个元素的和。如果一个Fibonacci数与所有小于它的Fibonacci数互质,那么称之为Fibonacci质数。
现在要求你输出前n个Fibonacci数
The Fibonacci Numbers {0, 1, 1,
2, 3, 5, 8, 13, 21, 34, 55 ...} are defined by the recurrence:
F(0)=0
F(1)=1
F(i)=F(i-1)+F(i-2)
Write a program to calculate the Fibonacci Numbers.
Input
The first line of the
input file contains a single integer T, the number of test cases. The following
T lines,each contains an integer n ( 0 <= n <= 45 ), and you are expected
to calculate Fn
Output
Output Fn on a
separate line.
Sample Input 
5
0
3
5
9
20
Sample Output
0
2
5
34
6765
Source
#include<stdio.h>
int main(){
int T,a[]={,,};
for(int i=;i<=;i++){
a[i]=a[i-]+a[i-];
}
scanf("%d",&T);
for(int i=;i<T;i++){
int n;
scanf("%d",&n);
printf("%d\n",a[n]);
}
return ;
}
1147: 零起点学算法54——Fibonacc的更多相关文章
- Problem G: 零起点学算法86——Fibonacc
#include<stdio.h> int main(){ ]={,,}; ;i<=;i++) { a[i]=a[i-]+a[i-]; } scanf("%d", ...
- 1164: 零起点学算法71——C语言合法标识符(存在问题)
1164: 零起点学算法71——C语言合法标识符 Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted: 10 ...
- 1163: 零起点学算法70——Yes,I can!
1163: 零起点学算法70--Yes,I can! Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted: ...
- 1145: 零起点学算法52——数组中删数II
1145: 零起点学算法52--数组中删数II Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted: 293 ...
- 1137: 零起点学算法44——多组测试数据输出II
1137: 零起点学算法44--多组测试数据输出II Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted: ...
- 1136: 零起点学算法43——多组测试数据输出I
1136: 零起点学算法43--多组测试数据输出I Time Limit: 1 Sec Memory Limit: 128 MB 64bit IO Format: %lldSubmitted: ...
- 1135: 零起点学算法42——多组测试数据(求和)IV
1135: 零起点学算法42--多组测试数据(求和)IV Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted ...
- 1134: 零起点学算法41——多组测试数据(a+b)III
1134: 零起点学算法41--多组测试数据(a+b)III Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitt ...
- 1133: 零起点学算法40——多组测试数据(a+b)II
1133: 零起点学算法40--多组测试数据(a+b)II Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitte ...
随机推荐
- C#中获取不同的日期时间格式
通过调用类中的各种方法我们可以获取不同的时间: 如:日期(2008-09-04).时间(12:12:12).日期+时间(2008-09-04 12:11:10)等. //获取日期+时间 DateTim ...
- UI培训自学能学好吗
近年来UI设计师愈来愈红,成为行业热门,越来越多的人开始专注UI培训,也有一部分人在考虑,培训班一般价格不菲,我自学怎么样呢? UI设计是指人机交互过程中的一个界面设计,常用到的有 ps和ai两个工具 ...
- jQuery的基本操作
jQuery就是一个js的库· 主要分为两部分: 1·寻找元素 (选择器,筛选器) 2·操作元素 (CSS的操作,属性的操 ...
- 数据库 t-sql 语句
sql 高级语句 在基础语句上加上条件 条件修改: update 表名set 列明=要修改的值 where 列名 =原来的值 条件删除 删除 这个值的的一行 delete from 表名 ...
- SpringBoot之旅 -- 定时任务两种(Spring Schedule 与 Quartz 整合 )实现
相关文章 Spring Boot 相关文章目录 前言 最近在项目中使用到定时任务,之前一直都是使用Quartz 来实现,最近看Spring 基础发现其实Spring 提供 Spring Schedul ...
- Pascal's Triangle II leetcode
Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3, ...
- 3631: [JLOI2014]松鼠的新家
3631: [JLOI2014]松鼠的新家 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 707 Solved: 342[Submit][Statu ...
- swift -- 单例
方式一: (类似OC) class SingletonDispatch{ class var shareInstance : SingletonDispatch { //结构体 struct Stat ...
- CoreAnimation 寄宿图
#CoreAnimation 寄宿图 寄宿图:图层中所包含的图 by:旭宝爱吃鱼 针对于寄宿图我在这里只讨论contents属性以及Custom Drawing. contents content:内 ...
- CRUD操作(20161017)
上午: (7)范围查询 select * from car where price>40 and price<60 select * from car where price betwee ...