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. 五个免费UML建模工具推荐

    UML工具很多是商用的,价格不菲:而免费的UML建模工具,功能完善的很少.以下推荐的是五个免费的UML建模工具,相对而言还算功能比较不错. 1.免费UML建模工具推荐:JUDE – community ...

  2. scala知识点(二)

    Scala允许使用三个引号来进行多行字符引用:(引自) val longString = """Line 1 Line Line """; ...

  3. Printer Queue

    Description The only printer in the computer science students' union is experiencing an extremely he ...

  4. java实现附件预览(openoffice+swfTools+FlexPaper) (转载)

    下边例子是在网上找了一个网友做的例子,在次记录 1.概述 主要原理 1.通过第三方工具openoffice,将word.excel.ppt.txt等文件转换为pdf文件 2.通过swfTools将pd ...

  5. jQuery uploadify-v3.1 批量上传

    引用: <link href="/UI.Web.CRM.Main/jQuery.Uploadify/uploadify.css" rel="stylesheet&q ...

  6. ITaCS Change Password web part

    http://changepassword.codeplex.com/ A webpart is used to change your sharepoint AD password.

  7. 对日期和时间的处理 NSCalendar

    代码较老,供参考 NSCalendar用于处理时间相关问题.比如比较时间前后.计算日期所的周别等. 1. 创建或初始化可用以下方法 + (id)currentCalendar; 取得当前用户的逻辑日历 ...

  8. Python读写文件 - 转

    http://blog.csdn.net/adupt/article/details/4435615 http://docs.python.org/release/2.5.2/lib/bltin-fi ...

  9. 用css制作三角形

    用css制作三角形,主要是利用css元素给“盒模型”设置边框得到的. 上图,上边框和做边框,以及上边框和右边框的交合处,浏览器会按照直角的二分之一处绘制交合线.这是“盒模型”有宽和高时候的效果.我们假 ...

  10. uva 10608

    简单并查集  水水..... #include <cstdio> #include <cstring> #define maxn 30005 int fa[maxn],ans[ ...