hdu-1865-1sting(大数问题)
来源:互联网 发布:java获取当年的第一天 编辑:程序博客网 时间:2024/05/02 04:28
1sting
Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 3870 Accepted Submission(s): 1463
Total Submission(s): 3870 Accepted Submission(s): 1463
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
311111111
Sample Output
128
Author
z.jt
Source
2008杭电集训队选拔赛——热身赛
Recommend
lcy | We have carefully selected several similar problems for you: 1133 2100 1297 1866 1868
按字符串长度递推,然后2的n次方是个大数
/* * http://acm.hdu.edu.cn/showproblem.php?pid=1865 * by jtahstu on 2015/3/31 14:00 */package 大数;import java.math.BigInteger;import java.util.Scanner;public class HDU1865 {public static Scanner cin = new Scanner(System.in);public static void main(String[] args) {// TODO 自动生成的方法存根int n = cin.nextInt();BigInteger a[] = new BigInteger[201];a[1] = BigInteger.valueOf(1);a[2] = BigInteger.valueOf(2);for (int i = 3; i <= 200; i++)a[i] = a[i - 1].add(a[i - 2]);//递推,只是这是大数while (n-- > 0) {String s;s = cin.next();int len = s.length();System.out.println(a[len]);}}}
0 0
- hdu-1865-1sting(大数问题)
- HDOJ/HDU 1865 1sting(斐波拉契+大数~)
- hdu 1865 1sting(数学:斐波那契+大数)
- hdu 1865 1sting (java大数&递推)
- hdu 1865 ny 655 1sting【大数斐波拉切】
- hdu 1865 1sting
- HDU 1865 1sting
- hdu 1865 1sting
- hdu 1865 1sting
- HDU-1865-1sting
- hdu 1865 1sting
- HDU-1865-1sting
- HDU 1865 1sting
- hdu 1865 1sting
- HDU 1865 1sting
- hdu1865大数 1sting
- hdu1865 1 sting(大数)
- HDU 1865 1sting(大数斐波那契数列,模拟加法)
- iOS:编译错误 linker command failed with exit code 1 (use -v to see invocation)
- Python实例浅谈之三Python与C/C++相互调用
- 基于“ViewHolder”技术提升Android ListView中Item View加载效率
- malloc函数
- Linux vsftp安装 - 解决vsftpd的530 Login incorrect错误
- hdu-1865-1sting(大数问题)
- Android中invalidate()和postInvalidate() 的区别
- Apache OFBIZ快速上手(四)--云服务模式--OFBIZ多租户
- 黑马程序员-OC-点语法
- 修改struts2中UI标签的<s:a>进行权限控制
- 面试题16:反转链表
- Could not load com.mysql.jdbc.SQLError. 解决办法
- Ajax POSt数据到PHP的方法
- Lua:元表(metatable)与元方法(meatmethod)