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. Oracle中表列由VARCHAR2类型改成CLOB

    情景 原来表中的列定义成VARCHAR2类型,众所周知,VARCHAR2类型最大支持长度为4000.假设因为业务须要.想把此列转换为CLOB类型,在Oracle中直接通过ALTER语句转换是行不通的. ...

  2. 玩转OpenStack

    一.OpenStack包含那些内容 1.预备知识 首先会有虚拟化和云计算的“预备知识”,会介绍 KVM,IaaS 等技术. 2.OpenStack核心 包含OpenStack的架构和和各个核心组件. ...

  3. JavaScript生成GUID的方法

    一.生成GUID的方法一     JScript 代码   复制 function guid() { function S4() { return (((1+Math.random())*0x1000 ...

  4. 关于COM的Unicode string的精彩论述

    I need to make a detour for a few moments, and discuss how to handle strings in COM code. If you are ...

  5. easyui combotree不让父级选中

    easyui combotree不让父级选中? <ul id="combotree"></ul> $(function () { $("#comb ...

  6. 程序员们必备的10款免费jquery插件

    本周带来10款免费的jquery插件.如果你也有好的作品,欢迎分享到社区中来,在得到帮助的同时,也能与更多人分享来自你的作品. jQuery导航菜单置顶插件 - stickyUp . 在线演示 sti ...

  7. Greenplum query Oracle via DLINK

    在系统日常生产过程中.怎样从Oracle数据库同步一些配置表到GP库个问题. 先来说说之前使用的方式: 0. 使用第3方工具从Oracle导出纯文本格式,存放在本地: 1. 使用GP外部表载入入库 这 ...

  8. 翻译记忆软件-塔多思TRADO经典教程_2

    Trados 中文简明教程Trados 中文简明教程1. 准备工作 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

  9. shapefile文件的符号化问题

    我们都知道,ArcGIS的shp文件只以坐标形式保存地图数据,地图的显示方法则是存储都数据库或地图文件(mxd)中,这一点是深信不疑的. 如果我们打开ArcMap,新建一个普通的地图文件(使用标准的模 ...

  10. JBOSS启动报错解决方案

    同一个jboss下不可以放不同的项目包,否则报错: 注意:如果后期使用,注意删除上图的本地文件,重新加载即可.