1254 Problem V
问题 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的更多相关文章
- Problem V
Problem Description The aspiring Roy the Robber has seen a lot of American movies, and knows that th ...
- Problem V: 零起点学算法20——输出特殊值II
#include<stdio.h> int main() { printf("\\n"); ; }
- 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 ...
- 菜鸟带你飞______DP基础26道水题
DP 158:11:22 1205:00:00 Overview Problem Status Rank (56) Discuss Current Time: 2015-11-26 19:11:2 ...
- [kuangbin带你飞]专题十四 数论基础
ID Origin Title 111 / 423 Problem A LightOJ 1370 Bi-shoe and Phi-shoe 21 / 74 Problem B ...
- Simple Addition
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=31329#problem/V 使用题目所给函数,单单从某一个数字来看,就是直接求这个数各个 ...
- Fibinary Numbers
http://acm.hust.edu.cn/vjudge/contest/view.action?cid=30506#problem/V 题意:从右向左,每一个位数,分别表示一个fibonacci数 ...
- Maximum GCD(fgets读入)
Maximum GCD https://vjudge.net/contest/288520#problem/V Given the N integers, you have to find the m ...
- HDU 4513 吉哥系列故事――完美队形II(Manacher)
题目链接:cid=70325#problem/V">[kuangbin带你飞]专题十六 KMP & 扩展KMP & Manacher V - 吉哥系列故事――完美队形I ...
随机推荐
- iOS开发- 自己主动消失的弹出框
- (void)timerFireMethod:(NSTimer*)theTimer//弹出框 { UIAlertView *promptAlert = (UIAlertView*)[theTimer ...
- Java笔记9:Spring简单Demo
1 下载spring-framework-3.0.5.RELEASE-with-docs.zip和spring-framework-3.0.5.RELEASE-dependencies.zip,放 ...
- tomcat进阶操作
1.使用war包部署web站点 [root@tomcat webapps]# pwd /application/tomcat/webapps [root@tomcat webapps]# rz ...
- [Angular] Angular Custom Change Detection with ChangeDetectorRef
Each component has its own ChangeDetectorRef, and we can inject ChangeDetectorRef into constructor: ...
- 说说Linux文件权限那些事儿
文件全部权 显示文件的全部权 更改文件的全部权 文件的权限 改动文件的权限 用符号表示法改动 用数字表示法改动 使用umask指定默认的文件权限 參考文献 首先我们要知道Linux的标准文件权限和安全 ...
- crm查询和删除审核历史记录
using System; using System.Linq; using Microsoft.Xrm.Sdk; using Microsoft.Xrm.Sdk.Query; ...
- TP框架中模糊查询实现
TP框架中模糊查询实现 $where['g.name'] = array('like','%'.$groupname.'%'); 表达式查询 上面的查询条件仅仅是一个简单的相等判断,可以使用查询表达式 ...
- HTML--百度百科
超文本标记语言,标准通用标记语言下的一个应用. “超文本”就是指页面内可以包含图片.链接,甚至音乐.程序等非文字元素. 超文本标记语言的结构包括“头”部分(英语:Head).和“主体”部分(英语:Bo ...
- js比较数字相等
示例代码: <!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF ...
- js标准化价钱
//标准化总价钱 s:总价钱,n:保留几位小数 function fmoney(s, n) { n = n > 0 && n <= 20 ? n : 2; s = pars ...