hdu4639Hehe
http://acm.hdu.edu.cn/showproblem.php?pid=4639
统计连续he的数量恰为斐波序列 不同块进行相乘
#include <iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<stdlib.h>
#define mod 10007
using namespace std;
char ss[];
int f[];
int main()
{
int t,i,k,kk=;
cin>>t;
f[] = ;f[] = ;
for(i = ; i <= ; i++)
f[i] = (f[i-]%mod+f[i-]%mod)%mod;
while(t--)
{
cin>>ss;kk++;
k = strlen(ss);
int g = ,s=;
for(i = ; i < k ;i++)
{
if((i+)<k&&ss[i]=='h'&&ss[i+]=='e')
{
g++;
i++;
continue;
}
else if(g!=)
{
s=(s*f[g])%mod;
g=;
}
}
if(g)
s = (s*f[g])%mod;
printf("Case %d: ",kk);
cout<<s<<endl;
}
return ;
}
hdu4639Hehe的更多相关文章
随机推荐
- Pandas简易入门(四)
本节主要介绍一下Pandas的另一个数据结构:DataFrame,本文的内容来源:https://www.dataquest.io/mission/147/pandas-internals-dataf ...
- linux crontab 命令
Linux 系统提供了使用者控制计划任务的命令 :crontab 命令. 一.crond简介 crond是linux下用来周期性的执行某种任务或等待处理某些事件的一个守护进程,与windows下的计划 ...
- 简单3d RPG游戏 之 002 生命条(二)
在游戏中,游戏人物的血条可能会因为受伤或吃血瓶而长度变化,所以需要将血条的长度单独提出来作为一个变量,方便直接修改数值. public float healthBarLength; 改变生命值函数如下 ...
- 你不需要jQuery
http://www.webhek.com/you-do-not-need-jquery
- 深入js的面向对象学习篇(封装是一门技术和艺术)——温故知新(二)
下面全面介绍封装和信息隐藏. 通过将一个方法或属性声明为私用的,可以让对象的实现细节对其它对象保密以降低对象之间的耦合程度,可以保持数据的完整性并对其修改方式加以约束.在代码有许多人参与设计的情况下, ...
- 成功解决Tomcat-JDBC-MySQL乱码
0.MySQL-JDBC驱动文档 官方解释 1.数据库的字符编码和表内字段的编码 在MySQL中数据库的字符编码和表内字段的编码的要指定为utf8(utf8_general_ci) 2.jsp中 pa ...
- 2013流行Python项目汇总
2013流行Python项目汇总 转自:http://www.kankanews.com/ICkengine/archives/102963.shtml Python作为程序员的宠儿,越来越得到人们的 ...
- 【leetcode】Permutations II (middle)
Given a collection of numbers that might contain duplicates, return all possible unique permutations ...
- CodeForce 339:A+B+C
A题:水题.. #include<stdio.h> #include<string.h> ; char s[ maxn ]; int main(){ //freopen(&qu ...
- CentOS7.1配置远程桌面
网上看了很多资料,完全是乱的. 我使用的是CentOS7.1的系统.我的要求是windows的客户机可以远程访问CentOS系统. 1,首先需要检查一下服务器是否已经安装了VNC服务,检查服务器的是否 ...