hdu4639Hehe
http://acm.hdu.edu.cn/showproblem.php?pid=4639
统计连续he的数量恰为斐波序列 不同块进行相乘
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
1 #include <iostream> 2 #include<cstring> 3 #include<cstdio> 4 #include<algorithm> 5 #include<stdlib.h> 6 #define mod 10007 7 using namespace std; 8 char ss[11000]; 9 int f[11000]; 10 int main() 11 { 12 int t,i,k,kk=0; 13 cin>>t; 14 f[1] = 1;f[2] = 2; 15 for(i = 3; i <= 10086 ; i++) 16 f[i] = (f[i-1]%mod+f[i-2]%mod)%mod; 17 while(t--) 18 { 19 cin>>ss;kk++; 20 k = strlen(ss); 21 int g = 0,s=1; 22 for(i = 0 ; i < k ;i++) 23 { 24 if((i+1)<k&&ss[i]=='h'&&ss[i+1]=='e') 25 { 26 g++; 27 i++; 28 continue; 29 } 30 else if(g!=0) 31 { 32 s=(s*f[g])%mod; 33 g=0; 34 } 35 } 36 if(g) 37 s = (s*f[g])%mod; 38 printf("Case %d: ",kk); 39 cout<<s<<endl; 40 } 41 return 0; 42 }