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加解密相关函数

    openssl_public_encrypt()  - Encrypts data with public keyopenssl_public_decrypt()  - Decrypts data w ...

  2. linux 输入子系统(3)----事件处理(input_handler层)

    输入子系统主要设计input_dev.input_handler.input_handle.如下: [1]每个struct input_dev代表一个输入设备 struct input_dev { c ...

  3. compared woth QPSK, what is the advantages of QAM(16QAM or 64QAM?)

    1.QPSK QPSK是英文Quadrature Phase Shift Keying的缩略语简称,意为正交相移键控,是一种数字调制方式.在数字信号的调制方式中QPSK四相移键控是目前最常用的一种卫星 ...

  4. shell curl

    最近突然发现了一个有趣的问题:怎样判断日期是工作日还是节假日.(http://www.cnblogs.com/ZXdeveloper/p/4018886.html) 顺便发现了一个有用的网址:http ...

  5. Kinetic使用注意点--group

    new Group(config) 参数: config:包含所有配置项的对象. { x: "横坐标", y: "纵坐标", width: "宽度&q ...

  6. (转载)Cocos2dx-OpenGL ES 2.0教程:你的第一个三角形(1)

    前言 在本系列教程中,我会以当下最流行的2D引擎Cocos2D-X为基础,介绍OpenGL ES 2.0的一些基本用法.本系列教程的宗旨是OpenGL扫盲,让大家在使用Cocos2D-X过程中,知其然 ...

  7. 0ffice365 Calendar API

    Calendar REST API in Office 365 APIs Preview http://msdn.microsoft.com/EN-US/library/office/dn792114 ...

  8. iOS 状态栏管理

    iOS 7 以前:状态栏由 UIApplication 管理 1.隐藏状态栏 : application.statusBarHidden = NO; 2.设置状态栏样式 : application.s ...

  9. wordpress换域名后无法登陆的解决方案

    第一步:登录到你的数据库管理页面,找到wp_options表: 第二步:将表中的siteurl和home字段的值修改为当前的新域名,siteurl值的修改和home值的修改同理.如下图:

  10. Delphi XE5 android openurl(转)

    直接上代码: unit OpenViewUrl; interface // URLEncode is performed on the URL// so you need to format it p ...