1sting

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

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
Recommend
lcy
 简单大数题....
代码:
 #include<iostream>
#include<string>
#define maxn 50
#define len 200
using namespace std;
int arr[len][maxn+]={{},{}};
int main()
{
int i,j,s,c,t;
string n ;
for(i=;i<=len;i++)
{
for(c=j=;j<=maxn;j++)
{
s=arr[i-][j]+arr[i-][j]+c;
arr[i][j]=s%;
c=(s-arr[i][j])/;
}
}
cin>>t;
while(t--)
{
cin>>n;
for(i=maxn;arr[n.size()][i]==;i--);
for(j=i;j>=;j--)
{
printf("%d",arr[n.size()][j]);
}
puts("");
}
return ;
}

HDUOJ--1865 1string的更多相关文章

  1. HDU - 1865 1string(大数)

    题目链接:http://acm.hust.edu.cn/vjudge/contest/121397#problem/F http://acm.hdu.edu.cn/showproblem.php?pi ...

  2. hduoj 1455 && uva 243 E - Sticks

    http://acm.hdu.edu.cn/showproblem.php?pid=1455 http://uva.onlinejudge.org/index.php?option=com_onlin ...

  3. hduoj 4712 Hamming Distance 2013 ACM/ICPC Asia Regional Online —— Warmup

    http://acm.hdu.edu.cn/showproblem.php?pid=4712 Hamming Distance Time Limit: 6000/3000 MS (Java/Other ...

  4. hduoj 4706 Herding 2013 ACM/ICPC Asia Regional Online —— Warmup

    hduoj 4706 Children's Day 2013 ACM/ICPC Asia Regional Online —— Warmup Herding Time Limit: 2000/1000 ...

  5. hdu-oj 1874 畅通工程续

    最短路基础 这个题目hdu-oj 1874可以用来练习最短路的一些算法. Dijkstra 无优化版本 #include<cstdio> #include<iostream> ...

  6. C#版 - HDUoj 5391 - Zball in Tina Town(素数) - 题解

    版权声明: 本文为博主Bravo Yeung(知乎UserName同名)的原创文章,欲转载请先私信获博主允许,转载时请附上网址 http://blog.csdn.net/lzuacm. HDUoj 5 ...

  7. C++版 - HDUoj 2010 3阶的水仙花数 - 牛客网

    版权声明: 本文为博主Bravo Yeung(知乎UserName同名)的原创文章,欲转载请先私信获博主允许,转载时请附上网址 http://blog.csdn.net/lzuacm. C++版 - ...

  8. HDUOJ题目HTML的爬取

    HDUOJ题目HTML的爬取 封装好的exe/app的GitHub地址:https://github.com/Rhythmicc/HDUHTML 按照系统选择即可. 其实没什么难度,先爬下来一个题目的 ...

  9. hduoj题目分类

    基础题:1000.1001.1004.1005.1008.1012.1013.1014.1017.1019.1021.1028.1029.1032.1037.1040.1048.1056.1058.1 ...

随机推荐

  1. 快速入门:十分钟学会PythonTutorial - Learn Python in 10 minutes

    This tutorial is available as a short ebook. The e-book features extra content from follow-up posts ...

  2. IDEA的注册

    步骤: license server -> 属性 -> 允许作为程序执行文件 即 chmod 777

  3. 安装在virtualbox中的kali linux如何配置无线网卡

    1.安装在virtualbox里的kali无法使用所在物理机的wifi 2.必须通过usb方式,如图所示 3.所使用的usb无线网卡必须是kali2.0支持的 4.我的型号是TL-WN823N 2.0 ...

  4. 使用navicat工具创建MySQL存储过程

    使用Navicat for MySQL工具创建存储过程步骤: 1. 新建函数(选择函数标签 -> 点击新建函数): 2.输入函数的参数个数.参数名.参数类型等: 3.编写存储过程:  代码如下: ...

  5. JSP中解决中文乱码

    <%@ page language="java" contentType="text/html;charset=gbk" pageEncoding=&qu ...

  6. Windows环境搭建Red5流媒体服务器

    Windows环境搭建Red5流媒体服务器指南 测试环境:Windows 7 一.   下载安装程序 red5-server 下载地址 https://github.com/Red5/red5-ser ...

  7. maven mvn Failed during checkstyle execution

    maven 命令默认强制使用checkstyle, 造成 命令运行失败 并报错: Failed during checkstyle execution 关闭checkstyle,命令如下: mvn [ ...

  8. 牛气冲天的Iframe应用笔记

    纵观时下网站,本来网速就有些慢,可是几乎每页都要放什么Banner,栏目图片,版权等一大堆雷同的东西,当然,出于网站风格统一.广告效应的需要,本无可厚非,可毕竟让用户的钱包为这些“点缀“的东西”日益消 ...

  9. [CSS3]Clearfix

    <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="index ...

  10. 为什么要使用href=”javascript:void(0);”?

    JavaScript中语句最后的分号是可以缺省的,那为何要使用javascript:;而不是javascript:呢? 是习惯还是规范,我疑惑了! 具有代码洁癖的coder们,没事多写一个分号,圣洁的 ...