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. UVC调试

    USB video class(又称为USB video device class or UVC)就是USB device class视频产品在不需要安装任何的驱动程序下即插即用,包括摄像头.数字摄影 ...

  2. [Git] git代码统计

    copy : https://www.cnblogs.com/liyropt/archive/2012/12/31/2841053.html 命令行 查看git上的个人代码量: git log --a ...

  3. [11] 楔形体(Wedge)图形的生成算法

    顶点数据的生成 bool YfBuildWedgeVertices ( Yreal width, Yreal length, Yreal height, YeOriginPose originPose ...

  4. jquery中filter(fn)的使用研究

    jquery中filter(fn)给出的官方说明是: 筛选出与指定函数返回值匹配的元素集合 这个函数内部将对每个对象计算一次 (正如 '$.each'). 如果调用的函数返回false则这个元素被删除 ...

  5. Vue路由scrollBehavior滚动行为控制锚点

    使用前端路由,当切换到新路由时,想要页面滚到顶部,或者是保持原先的滚动位置,就像重新加载页面那样. vue-router 能做到,而且更好,它让你可以自定义路由切换时页面如何滚动. 注意: 这个功能只 ...

  6. IE浏览器无法直接识别input的type="hidden"问题

    原问题: <td class="formValue" id="in-checkbox"> <label class="checkbo ...

  7. linux CentOS7 安装scala

    1.打开terminal ,进入当前用户路径: cd /home/sks 2.下载Scala2.11 wget https://downloads.lightbend.com/scala/2.11.8 ...

  8. DateNavigator

    <Border BorderThickness="1,1,1,1" BorderBrush="Black" Grid.Column="1&quo ...

  9. python时间格式化及前推

    import datetime >>> (datetime.datetime.now() - datetime.timedelta(seconds = 300)).strftime( ...

  10. Mysql创建多列唯一索引Sql

    ALTER TABLE `t_city_combo` ADD UNIQUE INDEX ` t_city_combo_index` (`combo_id`, `combo_name`, `city_i ...