HDU 4639 Hehe (2013多校4 1008 水题)
Hehe
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 33 Accepted Submission(s): 22
T<=100
The length of each sentence <= 10086
wanshangniyoukongme
womenyiqichuqukanxingxingba
bulehehewohaiyoushi
eheheheh
Case 2: 1
Case 3: 2
Case 4: 3
很水
/*
* Author:kuangbin
* 1008.cpp
*/ #include <stdio.h>
#include <algorithm>
#include <string.h>
#include <iostream>
#include <map>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <math.h>
using namespace std;
const int MOD = ;
int dp[];
void init()
{
dp[] = ;
dp[] = ;
dp[] = ;
for(int i = ;i < ;i++)
dp[i] = (dp[i-] + dp[i-])%MOD;
} char str[]; int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
int T;
scanf("%d",&T);
int iCase = ;
init();
while(T--)
{
iCase ++;
scanf("%s",str);
int ans = ;
int len = strlen(str);
for(int i = ; i < len;i++)
{
if(str[i] == 'h')
{
int cnt = ;
for(int j = i ; j+ <len;j+=)
{
if(str[j]!='h'||str[j+]!='e')break;
cnt++;
}
ans = ans*dp[cnt]%MOD;
if(cnt > )
{
i += cnt*;
i--;
}
}
}
printf("Case %d: %d\n",iCase,ans);
}
return ;
}
HDU 4639 Hehe (2013多校4 1008 水题)的更多相关文章
- HDU 4662 MU Puzzle (2013多校6 1008 水题)
MU Puzzle Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total S ...
- HDU 4639 Hehe 2013 Multi-University Training Contest 4
题意大致如下:屌丝找女神聊天,女神回了一句 hehe ,而我们都知道 Hehe 有两个意思,一个就是 Hehe ,另外一个则是 wqnmlgb (我去年买了个表) ,所以屌丝很纠结,于是开始思考到底女 ...
- HDU 5832 A water problem (带坑水题)
A water problem 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5832 Description Two planets named H ...
- HDU 5889 Barricade(最短路+最小割水题)
Barricade Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total ...
- HDU 4639 hehe 杭电2013多校联赛第四场1008题
解题报告:题目的意思是输入一个字符串,并规定,里面的“hehe”可以用"wqnmlgb"来代替,也可以不代替,问输入的这个字符串在经过相关的代替之后可以有多少种不同的形态.先打一个 ...
- HDU 4618 Palindrome Sub-Array (2013多校2 1008 暴力)
Palindrome Sub-Array Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Oth ...
- hdu 4639 Hehe
http://acm.hdu.edu.cn/showproblem.php?pid=4639 每一段 "hehe..... " 相互独立 将每一段 "hehe..... ...
- 【斐波那契DP】HDU 4639——HeHe
题目:点击打开链接 多校练习赛4的简单题,但是比赛的时候想到了推导公式f(n)=f(n-1)+f(n-2)(就是斐波那契数列),最后却没做出来. 首先手写一下he(不是hehe)连续时的规律.0-1 ...
- hdu 4639 Hehe (dp)
一道dp题,转移方程不是自己推出来的. 题目的意思是用‘qnmlgb’替换‘hehe’,可以替换也可以不替换,问有多少种情况. 如果结尾不是‘hehe’,那么dp[i]=dp[i-1],如果是是‘he ...
随机推荐
- macaca安装失败的解决办法!
https://github.com/macacajs/macaca-android https://www.jianshu.com/p/76a5be6c1036
- 设计模式之笔记--桥接模式(Bridge)
桥接模式(Bridge) 定义 桥接模式(Bridge),将抽象部分与它的实现部分分离,使它们都可以独立地变化. 类图 描述 Abstraction:定义抽象部分的接口,通常在这个接口里面要维护一个实 ...
- 在Xcode中使用自定义的代码片段提高效率
拖动代码的时候按住option键,很难拖,注意方法:< 引用于:http://www.2cto.com/kf/201409/336245.html
- _stdcall调用
以前看windows编程时一直有个 _stdcall 函数调用约定 一直不是很理解,只能硬记. 现在终于在<程序是怎样跑起来的>这本书书中找到了答案. 1. _stdcall 是stand ...
- PHP给图片加水印具体实现
给图片加水印实现方法如下: class Mark { public function __construct() { } /** * 加水印 * @param file $srcImg 要加水印的图片 ...
- Go语言练习之方法,接口,并发
多练练,有感觉了就写实际的东东. package main import ( "fmt" "math" "os" "time&qu ...
- 前端学习——css(初级)
1.Css盒模型(box model) web开发中,html的每个元素都是盒子,盒子可以装内容(content).可以有填充物(padding).有外壳(border) 和 外保护层(margin) ...
- 前端读者 | 如何判断Javascript对象是否存在
本文来自@阮一峰 Javascript语言的设计不够严谨,很多地方一不小心就会出错. 举例来说,请考虑以下情况. 现在,我们要判断一个全局对象myObj是否存在,如果不存在,就对它进行声明.用自然语言 ...
- requere.js优化js脚本加载方案,使用篇。
require.config({ paths: { "jquery": "jquery-3.2.1", 'index':"index" }} ...
- LoadRunner Agent Runtime Settings Configuration启动报错
解决方法: 关闭负载机器上的防火墙功能即可解决