博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HDU 4639 Hehe
阅读量:4603 次
发布时间:2019-06-09

本文共 2288 字,大约阅读时间需要 7 分钟。

Hehe

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)

Total Submission(s): 57    Accepted Submission(s): 43

Problem Description
As we all know, Fat Brother likes MeiZi every much, he always find some topic to talk with her. But as Fat Brother is so low profile that no one knows he is a rich-two-generation expect the author, MeiZi always rejects him by typing “hehe” (wqnmlgb). You have to believe that there is still some idealized person just like Fat Brother. They think that the meaning of “hehe” is just “hehe”, such like “hihi”, “haha” and so on. But indeed sometimes “hehe” may really means “hehe”. Now you are given a sentence, every “hehe” in this sentence can replace by “wqnmlgb” or just “hehe”, please calculate that how many different meaning of this sentence may be. Note that “wqnmlgb” means “我去年买了个表” in Chinese.
 

 

Input
The first line contains only one integer T, which is the number of test cases.Each test case contains a string means the given sentence. Note that the given sentence just consists of lowercase letters. T<=100 The length of each sentence <= 10086
 

 

Output
For each test case, output the case number first, and then output the number of the different meaning of this sentence may be. Since this number may be quite large, you should output the answer modulo 10007.
 

 

Sample Input
4
wanshangniyoukongme
womenyiqichuqukanxingxingba
bulehehewohaiyoushi
eheheheh
 

 

Sample Output
Case 1: 1
Case 2: 1
Case 3: 2
Case 4: 3
 

 

Source
 

 多校第四场1008,签到题一枚。

首先找出串中有多少处he,每一处都是几个he连在一起的

然后找规律发现对于连续n个he连在一起时,答案与斐波那契数有关,于是问题迎刃而解

可惜啊……比赛时被Case害惨了,Wrong Answer Wrong Answer Wrong Answer……

 

1 #include
2 #include
3 #include
4 #include
5 6 using namespace std; 7 8 int len; 9 long f[10000];10 char s[10100];11 vector
p;12 13 void initial()14 {15 f[0]=f[1]=1;16 17 for(int i=2;i<10000;i++)18 f[i]=(f[i-1]+f[i-2])%10007;19 }20 21 int main()22 {23 int t;24 25 initial();26 27 scanf("%d",&t);28 getchar();29 30 for(int z=1;z<=t;z++)31 {32 gets(s);33 34 len=strlen(s);35 p.clear();36 37 for(int i=0;i
[C++]

 

转载于:https://www.cnblogs.com/lzj-0218/p/3230695.html

你可能感兴趣的文章
(文件过多时)删除目录下全部文件
查看>>
T-SQL函数总结
查看>>
python 序列:列表
查看>>
web移动端
查看>>
pythonchallenge闯关 第13题
查看>>
linux上很方便的上传下载文件工具rz和sz使用介绍
查看>>
React之特点及常见用法
查看>>
【WEB前端经验之谈】时间一年半,或沉淀、或从零开始。
查看>>
优云软件助阵GOPS·2017全球运维大会北京站
查看>>
linux 装mysql的方法和步骤
查看>>
poj3667(线段树区间合并&区间查询)
查看>>
51nod1241(连续上升子序列)
查看>>
SqlSerch 查找不到数据
查看>>
集合相关概念
查看>>
Memcache 统计分析!
查看>>
(Python第四天)字符串
查看>>
个人介绍
查看>>
使用python动态特性时,让pycharm自动补全
查看>>
MySQL数据库免安装版配置
查看>>
你必知必会的SQL面试题
查看>>