【BZOJ-2295】我爱你啊 暴力
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
第2到 T + 1行,ftiasch的日记 (只包含'a'-'z' 和空格, 长度小于100001)
Output
Sample Input
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
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】我爱你啊 暴力相关推荐
- BZOJ 2295: 【POJ Challenge】我爱你啊
题目链接:传送门 看到题目就进来了 #include <iostream> #include <cstdio> #include <cstring> #includ ...
- bzoj 1024 生日快乐 暴力搜索
bzoj 1024 生日快乐 传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1024 Description windy的生日到了,为了庆祝生 ...
- BZOJ 1800: [Ahoi2009]fly 飞行棋【思维题,n^4大暴力】
1800: [Ahoi2009]fly 飞行棋 Time Limit: 10 Sec Memory Limit: 64 MB Submit: 1689 Solved: 1335 [Submit][ ...
- BZOJ 1199: [HNOI2005]汤姆的游戏 计算几何暴力
1199: [HNOI2005]汤姆的游戏 Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://www.lydsy.com/JudgeOnline/p ...
- BZOJ 2466 中山市选2009 树 高斯消元+暴力
题目大意:树上拉灯游戏 高斯消元解异或方程组,对于全部的自由元暴力2^n枚举状态,代入计算 这做法真是一点也不优雅... #include <cstdio> #include <cs ...
- bzoj 3752: Hack 预处理+暴力dfs
题目大意: 定义字符串的hash值\(h = \sum_{i=0}^{n-1}p^{n-i-1}s_i\) 现在给定K个长度不超过L的字符串S,对于每个字符串S,求字典序最小长度不超过L的字符串T使得 ...
- bzoj 1675: [Usaco2005 Feb]Rigging the Bovine Election 竞选划区(暴力)
1675: [Usaco2005 Feb]Rigging the Bovine Election 竞选划区 Time Limit: 5 Sec Memory Limit: 64 MB Submit: ...
- bzoj 1648: [Usaco2006 Dec]Cow Picnic 奶牛野餐(暴力DFS)
1648: [Usaco2006 Dec]Cow Picnic 奶牛野餐 Time Limit: 5 Sec Memory Limit: 64 MB Submit: 774 Solved: 480 ...
- BZOJ - 4810 [Ynoi2017]由乃的玉米田 莫队算法 + bitset 大暴力
大家都很强, 可与之共勉 . 4810: [Ynoi2017]由乃的玉米田 Time Limit: 30 Sec Memory Limit: 256 MB Description 由乃在自己的农田边散 ...
最新文章
- 弹出popwindow 背景变暗
- git放弃修改放弃增加文件
- 插入排序InsertionSort(Python实现)
- 【机器学习算法-python实现】决策树-Decision tree(2) 决策树的实现
- 10大黑客专用的 Linux 操作系统,你了解哪些?
- 在线颜色拾取器 - 资源篇
- 算法题存档20190204
- Dubbo学习笔记(二)
- Laravel测试驱动开发--功能测试
- JavaWeb——IOC
- java判断两个矩形是否相交_判断矩形相交以及求出相交的区域
- C语言实现汉诺塔(程序执行步骤详解)
- Windows电脑生成iOS证书p12及mobileprovision文件文档
- 未找到任何音频输出设备的解决方法
- (附源码)springboot应用支撑平台和应用系统 毕业设计 984655
- paypal 国际版网站集成
- 机器学习笔记——数据挖掘与机器学习区别以及课程内容
- C# word文档转换成PDF格式文档
- 用虚拟机搭建web服务器模拟学习项目发布
- html css精灵,CSS spirit /css精灵