2295: 【POJ Challenge】我爱你啊

Time Limit: 1 Sec  Memory Limit: 128 MB
Submit: 202  Solved: 141
[Submit][Status][Discuss]

Description

ftiasch是个十分受女生欢迎的同学,所以她总是收到许多情书。虽然她十分有魅力,然而她却是个低调的人。因此她从来不会告诉别人她到底收到了多少情书。

ftiasch的好朋友1tthinking想知道她到底收到了多少情书。1tthinking知道,ftiasch每次收到一封情书,就会在日记最后写下一个包含"luvletter"子序列的串。比如现在ftiasch的日记是alduddvdletterflusvletetedr,那么ftiasch可能受到了0、1、2封情书。现在给出一些ftiasch的日记,问对于每篇日记,ftiasch最多可能受到多少的情书。

某个序列的子序列是从最初序列通过去除某些元素但不破坏馀下元素的相对位置而形成的新序列。參考wikipedia。

Input

第1行,一个整数 T (0 ≤ T ≤ 100), 日记的数量。

第2到 T + 1行,ftiasch的日记 (只包含'a'-'z' 和空格, 长度小于100001)

Output

第1到T行,一个整数, 最大可能的情书数量。

Sample Input

5
t
llllluvletterrr
luvletterlauavalaeatataearaluvletter
is wzk a famous boy yes buz he always receives a lot of luv letters
my heart beats her waves at the shore of the world and writes upon it her signature in tears with the words i love thee

Sample Output

0
1
3
1
0

HINT

Source

Solution

真的不知道该说点啥,乱搞啊这是

Code

#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdio>
using namespace std;
int main()
{int t,ans,cnt;scanf("%d\n",&t);char s[10]="luvletter";while (t--){char ss[100010];gets(ss); ans=cnt=0;for (int i=0; i<strlen(ss); i++)if (ss[i]==s[cnt]){if (cnt==8) ans++;cnt=(cnt+1)%9;}printf("%d\n",ans);}return 0;
}

我要妹子!我要妹子!我要妹子!重要的事说三遍

转载于:https://www.cnblogs.com/DaD3zZ-Beyonder/p/5344040.html

【BZOJ-2295】我爱你啊 暴力相关推荐

  1. BZOJ 2295: 【POJ Challenge】我爱你啊

    题目链接:传送门 看到题目就进来了 #include <iostream> #include <cstdio> #include <cstring> #includ ...

  2. bzoj 1024 生日快乐 暴力搜索

    bzoj 1024 生日快乐 传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1024 Description windy的生日到了,为了庆祝生 ...

  3. BZOJ 1800: [Ahoi2009]fly 飞行棋【思维题,n^4大暴力】

    1800: [Ahoi2009]fly 飞行棋 Time Limit: 10 Sec  Memory Limit: 64 MB Submit: 1689  Solved: 1335 [Submit][ ...

  4. BZOJ 1199: [HNOI2005]汤姆的游戏 计算几何暴力

    1199: [HNOI2005]汤姆的游戏 Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://www.lydsy.com/JudgeOnline/p ...

  5. BZOJ 2466 中山市选2009 树 高斯消元+暴力

    题目大意:树上拉灯游戏 高斯消元解异或方程组,对于全部的自由元暴力2^n枚举状态,代入计算 这做法真是一点也不优雅... #include <cstdio> #include <cs ...

  6. bzoj 3752: Hack 预处理+暴力dfs

    题目大意: 定义字符串的hash值\(h = \sum_{i=0}^{n-1}p^{n-i-1}s_i\) 现在给定K个长度不超过L的字符串S,对于每个字符串S,求字典序最小长度不超过L的字符串T使得 ...

  7. bzoj 1675: [Usaco2005 Feb]Rigging the Bovine Election 竞选划区(暴力)

    1675: [Usaco2005 Feb]Rigging the Bovine Election 竞选划区 Time Limit: 5 Sec  Memory Limit: 64 MB Submit: ...

  8. bzoj 1648: [Usaco2006 Dec]Cow Picnic 奶牛野餐(暴力DFS)

    1648: [Usaco2006 Dec]Cow Picnic 奶牛野餐 Time Limit: 5 Sec  Memory Limit: 64 MB Submit: 774  Solved: 480 ...

  9. BZOJ - 4810 [Ynoi2017]由乃的玉米田 莫队算法 + bitset 大暴力

    大家都很强, 可与之共勉 . 4810: [Ynoi2017]由乃的玉米田 Time Limit: 30 Sec Memory Limit: 256 MB Description 由乃在自己的农田边散 ...

最新文章

  1. 弹出popwindow 背景变暗
  2. git放弃修改放弃增加文件
  3. 插入排序InsertionSort(Python实现)
  4. 【机器学习算法-python实现】决策树-Decision tree(2) 决策树的实现
  5. 10大黑客专用的 Linux 操作系统,你了解哪些?
  6. 在线颜色拾取器 - 资源篇
  7. 算法题存档20190204
  8. Dubbo学习笔记(二)
  9. Laravel测试驱动开发--功能测试
  10. JavaWeb——IOC
  11. java判断两个矩形是否相交_判断矩形相交以及求出相交的区域
  12. C语言实现汉诺塔(程序执行步骤详解)
  13. Windows电脑生成iOS证书p12及mobileprovision文件文档
  14. 未找到任何音频输出设备的解决方法
  15. (附源码)springboot应用支撑平台和应用系统 毕业设计 984655
  16. paypal 国际版网站集成
  17. 机器学习笔记——数据挖掘与机器学习区别以及课程内容
  18. C# word文档转换成PDF格式文档
  19. 用虚拟机搭建web服务器模拟学习项目发布
  20. html css精灵,CSS spirit /css精灵

热门文章

  1. blender 批量单独导出模型
  2. DP1.4协议学习(二)Link层功能概述
  3. Word 办公小技巧(Microsoft Office 2016)
  4. Android 手机横竖屏切换
  5. LWN:利用 __GFP_UNMAPPED 减少direct-map 碎片化!
  6. 工具BlueSoleil千月蓝牙破解版,最好的蓝牙驱动
  7. 电磁波波长越短能量越强_在同一温度下波长越短的电磁波辐射强度越大
  8. 基于图关系归纳偏差的小样本交通预测
  9. Oracle查看表占用空间
  10. WordPress主题添加鼠标点击特效