问题 V: 光棍的yy

时间限制: 1 Sec  内存限制: 128 MB 提交: 42  解决: 22 [提交][状态][讨论版]

题目描述

yy经常遇见一个奇怪的事情,每当他看时间的时候总会看见11:11,这个很纠结啊

现在给你m个1,你可以把2个1组合成一个2,这样就不是光棍了,问这样的组合有多少种??

例如(111  可以拆分为 111 12 21  有三种)

输入

第一行输入一个n表示有n个测试数据 以下n行,每行输入m个1 (1 <= n,m <= 200)

输出

输出这种组合种数,占一行

样例输入

3
11
111
11111

样例输出

2
3
8 这个题实际上就是求前200个斐波那契数列+大数
 #include <iostream>
#include <string.h>
using namespace std; char a[];
int tag;
int f[][],t; void fb()
{
int i,j;
memset(f,,sizeof(f));
f[][]=f[][]=;
for(i=;i<;i++)
{
tag=;
for(j=;j<=;j++)
{
tag=f[i-][j]+f[i-][j]+tag;
f[i][j]=tag%;
tag/=;
}
}
} int main()
{
int na,i,j;
fb();
while(cin>>t)
{
while(t--)
{
cin>>a;
na=strlen(a);
for(i=;i>=;i--)
{
if(f[na][i]!=)
break;
}
for(j=i;j>=;j--)
{
cout<<f[na][j];
}
cout<<endl;
}
}
return ;
}

1254 Problem V的更多相关文章

  1. Problem V

    Problem Description The aspiring Roy the Robber has seen a lot of American movies, and knows that th ...

  2. Problem V: 零起点学算法20——输出特殊值II

    #include<stdio.h> int main() { printf("\\n"); ; }

  3. 2015-2016 ACM-ICPC Pacific Northwest Regional Contest (Div. 2)V - Gears

    Problem V | limit 4 secondsGearsA set of gears is installed on the plane. You are given the center c ...

  4. 菜鸟带你飞______DP基础26道水题

    DP 158:11:22 1205:00:00   Overview Problem Status Rank (56) Discuss Current Time: 2015-11-26 19:11:2 ...

  5. [kuangbin带你飞]专题十四 数论基础

            ID Origin Title   111 / 423 Problem A LightOJ 1370 Bi-shoe and Phi-shoe   21 / 74 Problem B ...

  6. Simple Addition

    http://acm.hust.edu.cn/vjudge/contest/view.action?cid=31329#problem/V 使用题目所给函数,单单从某一个数字来看,就是直接求这个数各个 ...

  7. Fibinary Numbers

    http://acm.hust.edu.cn/vjudge/contest/view.action?cid=30506#problem/V 题意:从右向左,每一个位数,分别表示一个fibonacci数 ...

  8. Maximum GCD(fgets读入)

    Maximum GCD https://vjudge.net/contest/288520#problem/V Given the N integers, you have to find the m ...

  9. HDU 4513 吉哥系列故事――完美队形II(Manacher)

    题目链接:cid=70325#problem/V">[kuangbin带你飞]专题十六 KMP & 扩展KMP & Manacher V - 吉哥系列故事――完美队形I ...

随机推荐

  1. Fillrate

    http://xionggf.com/articles/graphic/misc/mobile_gpu_term.html IMR Immediate Mode Rendering 立即渲染模式 TB ...

  2. python连接mysql并插入数据(自用)

    #coding=utf-8 import MySQLdb db = MySQLdb.connect("IP","用户名","密码",&quo ...

  3. [TypeScript] Deeply mark all the properties of a type as read-only in TypeScript

    We will look at how we can use mapped types, conditional types, self-referencing types and the “infe ...

  4. Material Design学习之 Bottom navigation

    转载请注明出处:王亟亟的大牛之路 礼拜4一天由于事假没有去单位然后礼拜3由于生日也没写文章,今天一早上班就补一篇MD的内容.这一篇是关于颇有争议的Bottom navigation相关内容(主要是翻译 ...

  5. System.getProperty("line.separator")

    转自:http://blog.sina.com.cn/s/blog_707577700100nv74.html 标题所写的代码能获得当前系统的换行符. 不要随便用 \n\r    \n    \r,因 ...

  6. 【Python】help与dir的用法

    当你给dir()提供一个模块名字时,它返回在那个模块中定义的名字的列表.当没有为其提供参数时, 它返回当前模块中定义的名字的列表. 如果您需要快速获取任何的Python函数或语句的信息,那么您可以使用 ...

  7. 【Excle】文本日期转化为日期格式

    现存在一列文本格式的日期 需要将该列转化为日期格式 方法一:使用分列 数据→分列,第三步选择[日期] 方法二:使用text函数 公式得到的结果为: 但是这样转化后的是文本型日期,需要转化为日期型得先转 ...

  8. Access 连接字符串全集

    连接 Access 2007 的操作方法   //无密码的连接字符串 string conStr = "Provider=Microsoft.Ace.OleDb.12.0;"; c ...

  9. javascript学习笔记(三)

    1.与命名空间相关的方法以及属性 2.任何支持style特性的HTML元素在Javascript中都有一个对应的style属性.这个属性是CSSStyleDecalration的实例, 包含着通过HT ...

  10. centos7下安装openvpn,访问内网服务器 (二) windows访问

    一.简介 在上一章中已经安装好了openvpn,并且已经启动成功,现在就可以通过openvpn的客户端进行连接访问内网服务器了. 二.安装openvpn客户端 下载地址: https://www.te ...