Hat's Fibonacci

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 10430    Accepted Submission(s): 3447

Problem Description
A Fibonacci sequence is calculated by adding the previous two members the sequence, with the first two members being both 1.
F(1) = 1, F(2) = 1, F(3) = 1,F(4) = 1, F(n>4) = F(n - 1) + F(n-2) + F(n-3) + F(n-4)
Your task is to take a number as input, and print that Fibonacci number.
 
Input
Each line will contain an integers. Process to end of file.
 
Output
For each case, output the result in a line.
 
Sample Input
100
 
Sample Output
4203968145672990846840663646

Note:
No generated Fibonacci number in excess of 2005 digits will be in the test data, ie. F(20) = 66526 has 5 digits.

 
2005位的数大概在7100左右
import java.math.BigInteger;
import java.util.Scanner; public class Main { public static void main(String[] args) {
BigInteger [] b = new BigInteger[];
b[]=b[]=b[]=b[]= BigInteger.valueOf();
int len = ;
for(int i=;i<;i++){
b[i] = b[i-].add(b[i-]).add(b[i-]).add(b[i-]);
}
Scanner sc = new Scanner(System.in);
while(sc.hasNext()){
int n = sc.nextInt();
System.out.println(b[n]);
}
}
}

hdu 1250(大整数)的更多相关文章

  1. hdu 1316(大整数)

    How Many Fibs? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)To ...

  2. hdu 4474 大整数取模+bfs

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4474 (a*10+b)%c = ((a%c)*10+b%c)%c; 然后从高位开始枚举能填的数字填充, ...

  3. hdu 4523(大整数)

    威威猫系列故事——过生日 Time Limit: 500/200 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total ...

  4. HDU 1212 大整数的取模运算

    因为这里是MOD最大为100000 所以我将字符串看作5个一组,并记录后面跟了多少个100000 每次取5个数根据其数据进行取模更新 注意过程中 100000*100000会超int #include ...

  5. HDU 1002 A + B Problem II(大整数相加)

    A + B Problem II Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u De ...

  6. HDOJ-1002 A + B Problem II (非负大整数相加)

    http://acm.hdu.edu.cn/showproblem.php?pid=1002 输入的数都是正整数,比较好处理,注意进位. //非负大整数加法 # include <stdio.h ...

  7. poj2389-Bull Math(大整数乘法)

    一,题意: 大整数乘法模板题二,思路: 1,模拟乘法(注意"逢十进一") 2,倒序输出(注意首位0不输出) 三,步骤: 如:555 x 35 = 19425  5 5 5  5 5 ...

  8. AC日记——大整数的因子 openjudge 1.6 13

    13:大整数的因子 总时间限制:  1000ms 内存限制:  65536kB 描述 已知正整数k满足2<=k<=9,现给出长度最大为30位的十进制非负整数c,求所有能整除c的k. 输入 ...

  9. Ac日记——大整数减法 openjudge 1.6 11

    11:大整数减法 总时间限制:  1000ms 内存限制:  65536kB 描述 求两个大的正整数相减的差. 输入 共2行,第1行是被减数a,第2行是减数b(a > b).每个大整数不超过20 ...

随机推荐

  1. 【线段树 扫描线 二维数点】loj#6276. 果树

    路径计数转成二维数点很妙啊 题目描述 NiroBC 姐姐是个活泼的少女,她十分喜欢爬树,而她家门口正好有一棵果树,正好满足了她爬树的需求. 这颗果树有 $N$ 个节点,标号 $1 \ldots N$ ...

  2. CPL学习笔记(一)

    整型 计算机的内存的基本单位是位(bit),可以将其看作电子开关,可以开,表示1:也可以关表示0. 字节(byte)通常指八位的内存单元. 8bit=1byte=1B; 1KB=1024B; 1M=1 ...

  3. Ubuntu16.04安装后开发工作的配置

    由于多次安装Ubuntu16.04用于学习,其中出了多次问题.每次找参考文件太麻烦,于是写了这篇总结,方便之后备用. 一.精简系统,删除不常用软件 参考资料来自:https://blog.csdn.n ...

  4. Voyager的Roles和Pemissions

    以Page为例讲解: 取消admin的roles下Pages的Browse Pages权限: 打开web.php文件,添加: Route::get('pages', function(){ retur ...

  5. Voyager下的Media Manager文件管理与Menu Builder

    Media Manager 默认存储位置在storage/app/public 上传文件,新建文件夹,移动,重命名,删除等等等功能 Menu Builder 创建新的Main菜单 创建一个shop菜单 ...

  6. 日志切割logrotate和定时任务crontab详解

    1.关于日志切割 日志文件包含了关于系统中发生的事件的有用信息,在排障过程中或者系统性能分析时经常被用到.对于忙碌的服务器,日志文件大小会增长极快,服务器会很快消耗磁盘空间,这成了个问题.除此之外,处 ...

  7. PTA 7-1 银行业务队列简单模拟

    用链表实现队列操作,代码如下: #include <iostream> #include <cstdio> #include <algorithm> #includ ...

  8. 字符串-POJ3974-Palindrome

    Palindrome Time Limit: 15000MS Memory Limit: 65536K Description Andy the smart computer science stud ...

  9. emacs设置字体

    * C-h f set-default-font set-default-font is an alias for `set-frame-font' in `frame.el'. (set-defau ...

  10. pidgin中使用QQ

    安装     实现的功能:   可以发送静态表情 可以发送动态表情 可以发图片? 可以添加好友 可以添加群?