问题 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. ThinkPHP 3.0~3.2 注入漏洞

    地址:http://xx.com/index.php/Admin.php?s=/User/Public/check payload:act=verify&username[0]=='1')) ...

  2. Python数据整合与数据准备-BigGorilla介绍

    参考文档:http://www.biggorilla.org/zh-hans/walkt/ 一.前言 “根据访谈记录和专家估计,数据科学家将50%至80%的时间花在搜集和准备难以梳理的数字数据的琐碎工 ...

  3. C# 关键字 Visual Studio 2012

    C# 关键字 Visual Studio 2012 其他版本 关键字是对编译器具有特殊意义的预定义保留标识符. 它们不能在程序中用作标识符,除非它们有一个 @ 前缀. 例如,@if 是有效的标识符,但 ...

  4. 恼人的The absolute uri: http://java.sun.com/jsp/jstl/core cannot be resolved...错误,无奈用Struts的bean:write替代了JSTL的C:out

    一个应用中有两个页面使用了JSTL的c:out输出,就类似这么简单三句 <c:if test="${!empty error}">       <h2>&l ...

  5. C语言中的union使用方法

    union共用声明和共用一变量定义: "联合"是一种特殊的类,也是一种构造类型的数据结构.在一个"联合"内能够定义多种不同的数据类型. 一个被说明为该" ...

  6. Oracle Database 11.2.0.4.0 已在 中标麒麟Linux x86-64 NeoKylin Linux Advanced Server 6 上通过认证

    啥都不说了,上截图:

  7. pat(B) 1037. 在霍格沃茨找零钱(水题)

    代码: #include<cstdio> #include<iostream> #include<cstring> #include<algorithm> ...

  8. 10、驱动中的阻塞与非阻塞IO

        阻塞,就是在获取资源的时候,不能获取到,那么就会将当前的进程挂起(睡眠,也就是将当前进程从调度器拿走了,不会调度当前进程),直到满足条件为止再进行操作.相反,非阻塞,就是即使不能获取到资源,非 ...

  9. spring事务管理源码解析--加了@Transactional注解后Spring究竟为我们做了哪些事情?

    大家都知道事务管理是基于AOP的,对AOP还不了解的请自行百度. 实现一个事务需要以下几步:1.获取数据库连接  2.执行数据库操作  3.如果2步骤发生异常就回滚,否则就提交  4.释放资源. 然后 ...

  10. 初学spring(二)

      1.spring推荐使用接口编程,配合di可以达到层与层之间解耦