题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1865

1sting

Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 4795    Accepted Submission(s): 1800

Problem Description

You will be given a string which only contains ‘1’; You can merge two adjacent ‘1’ to be ‘2’, or leave the ‘1’ there. Surly, you may get many different results. For example, given 1111 , you can get 1111, 121, 112,211,22. Now, your work is to find the total number of result you can get.
 

Input

The first line is a number n refers to the number of test cases. Then n lines follows, each line has a string made up of ‘1’ . The maximum length of the sequence is 200.
 

Output

The output contain n lines, each line output the number of result you can get .
 

Sample Input

3 1 11 11111
 

Sample Output

1 2 8
 

Author

z.jt
 

Source

2008杭电集训队选拔赛——热身赛
 

Recommend

lcy

思路:很明显的斐波那契数列。数据太大,用java实现。

附上AC代码:

import java.util.Scanner;
import java.math.BigInteger;
public class Main {final static int MAXN = 205;public static void main(String[] args) {// TODO Auto-generated method stubBigInteger fib[] = new BigInteger[MAXN];fib[0] = fib[1] = BigInteger.ONE;for (int i=2; i<fib.length; ++i)fib[i] = fib[i-1].add(fib[i-2]);Scanner in = new Scanner(System.in);int T = in.nextInt();while (T-- > 0){String str = in.next();System.out.println(fib[str.length()]);}in.close();}}

HDU 1865 1sting相关推荐

  1. [恢]hdu 1865

    2011-12-24 20:04:44 地址:http://acm.hdu.edu.cn/showproblem.php?pid=1865 题意:若干个1,可以选择相邻两个合并成2.问有多少种可能的结 ...

  2. HDU 1865 1string

    You will be given a string which only contains '1'; You can merge two adjacent '1' to be '2', or lea ...

  3. [转] HDU 题目分类

    转载来自:http://www.cppblog.com/acronix/archive/2010/09/24/127536.aspx 分类一: 基础题:1000.1001.1004.1005.1008 ...

  4. HDU题目分类啊!!!

    分类一(详细): 分类二: 基础题:1000.1001.1004.1005.1008.1012.1013.1014.1017.1019.1021.1028.1029.1032.1037.1040.10 ...

  5. HDU题目分类大全【大集合】

    基础题: 1000.1001.1004.1005.1008.1012.1013.1014.1017.1019.1021.1028.1029.  1032.1037.1040.1048.1056.105 ...

  6. HDU 5643 King's Game 打表

    King's Game 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5643 Description In order to remember hi ...

  7. 转载:Hdu 题目分类

    原址点击 基础题:1000.1001.1004.1005.1008.1012.1013.1014.1017.1019.1021.1028.1029. 1032.1037.1040.1048.1056. ...

  8. HDU——1106排序(istringstream的使用、STLvector练习)

    排序 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submiss ...

  9. hdu 5438 Ponds 拓扑排序

    Ponds Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/contests/contest_showproblem ...

最新文章

  1. 2022-2028年中国硅酸钙板行业市场研究及前瞻分析报告
  2. 对网络体系变革的思考
  3. 即插即用 | S-FPN全新的金字塔网络,更适合轻量化模型的FPN
  4. 蛋白质导论: 结构,功能和运动,第二版 Introduction to Proteins : Structure, Function, and Motion, Second Edition
  5. 大学生换学校学计算机,高校换上新课桌,同学表示“世界观被颠覆”,网友:黑科技的诞生...
  6. 帆软报表 js 调用sql_SQL Server中的报表–创建由先前创建的主报表调用的基于矩阵的子报表
  7. [置顶]大型网站技术架构(一)大型网站架构演化
  8. java composite 模式_《JAVA设计模式》中的组合模式Composite
  9. ubntu系统克隆到其他计算机的方法
  10. HTML中图片文件名字有括号,文件批量顺序重命名去掉括号
  11. 数据结构丿丶树 哈夫曼树
  12. MAR DASCTF 2021
  13. K3 CLOUD返工生产成本方案——循环计算
  14. vue加载中展示【nprogress(进度条)Lottie(动画)】
  15. 百度不显示免流量服务器,【免流】本地一键直连/百度直连/百度/直连
  16. 安卓u盘格式化工具apk_华为智慧屏U盘安装APP分享
  17. 头歌 共享单车大数据项目数据分析
  18. 华为Ascend昇腾CANN详细教程(二)
  19. RISC-V基本介绍
  20. 如何才能做一个淡定从容的人呢?

热门文章

  1. Python爬虫第一步之获取网页源代码
  2. 阿里代码检测p3c插件安装使用规则
  3. php利用P3P头实现跨域设置cookie
  4. 假设使用计算机进行售票其过程如下,2019年计算机考研:操作系统试题(十三)...
  5. 数组名与数组名取地址的差异
  6. RDBMS与非RDBMS对比
  7. 干货之如何利用Python程序赚钱
  8. 【Unity】文字游戏制作插件Fungus教程(6)碰撞触发和消息的发送和接收
  9. 电商项目(一)---------Sku和Spu以及电商项目商品的设计思路
  10. 我所推荐的深度学习学习路径