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的更多相关文章

随机推荐

  1. php获取数组中重复数据的两种方法

    分享下php获取数组中重复数据的两种方法. 1,利用php提供的函数,array_unique和array_diff_assoc来实现 <?php function FetchRepeatMem ...

  2. PHP去掉转义后字符串中的反斜杠\函数stripslashes

    addslashes函数主要是在字符串中添加反斜杠对特殊字符进行转义,stripslashes则是去掉转义后字符串中的反斜杠\,比如当你提交一段 json数据到PHP端的时候可能会遇到json字符串中 ...

  3. @Html.TextBox 的使用

    @Html.TextBox( }); //限制 text 的最大输入字符数为 10个 @Html.TextBox("users","",new {@class= ...

  4. scrapy-redis使用详解

    描述: 1.使用两台机器,一台是win10,一台是centos7,分别在两台机器上部署scrapy来进行分布式抓取一个网站 2.centos7的ip地址为192.168.1.112,用来作为redis ...

  5. 字符设备驱动中cdev与inode、file_operations的关系

    一.cdev与inode 二.cdev与file_operations

  6. Speech Patterns (string)

    People often have a preference among synonyms of the same word. For example, some may prefer "t ...

  7. MySQL中bin-log使用

    操作命令:show binlog events ; reset master 删除所有的二进制日志 flush logs 产生一个新的binlog日志文件 show master logs; 或者 s ...

  8. C++内存泄露调试

    我在看DirectX Sample的时候,看到以下代码: // Enable run-time memory check for debug builds. #if defined(DEBUG) | ...

  9. C#设计模式学习资料--观察者模式

    http://www.cnblogs.com/promise-7/archive/2012/05/14/2500759.html http://www.cnblogs.com/zhenyulu/art ...

  10. linux复制多个文件到文件夹

    linux复制多个文件到文件夹 cp file1 file2 file3 directory即将文件file1 file2 file3复制到directory