Boring count
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 932 Accepted Submission(s): 382
Problem Description
You
are given a string S consisting of lowercase letters, and your task is
counting the number of substring that the number of each lowercase
letter in the substring is no more than K.
Input
In the first line there is an integer T , indicates the number of test cases.
For each case, the first line contains a string which only consist of lowercase letters. The second line contains an integer K.
[Technical Specification]
1<=T<= 100
1 <= the length of S <= 100000
1 <= K <= 100000
Output
For each case, output a line contains the answer.
Sample Input
3
abc
1
abcabc
1
abcabc
2
Sample Output
Source
题意:找出一个字符串里面符合每个字幕出现次数都不大于K次的子串的个数。
题解:数据量达到了10^5,所以O(n^2)肯定不行,所以要用到尺取法。
整个过程分为4布:
1.初始化左右端点
2.不断扩大右端点,直到满足条件
3.如果第二步中无法满足条件,则终止,否则更新结果
4.将左端点扩大1,然后回到第二步
尺取法的过程是上述,但是,对于这题,我们要做少许改动,因为尺取法的条件终止条件是无法满足条件,但是这题我们首先扩充右端点的话是一直到不满足条件(找到某个字母出
现次数大于K的那个串再break),所以这题我们的条件应该改成r在外层循环,找到无法满足条件的子串后再一直扩充左端点,直到满足条件。接下来怎么算子串个数呢?我也不知道
,discuss区里面这样说的。。
aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAicAAAAjCAIAAADAPD21AAAMHklEQVR4nO1cPWsrzRXWX9hWxXt7c3ETMIoStYGQ0kUcX8MGgSGlOheGKwxasJo0AcMV6BYu1CzoFwjjylJhGxksXGxjwhQm1bryYsx1ivmeOTM70ivve8V7xIPRrmdnZ87MnGfOx6hG8gKBQCAQiGpQ+81bgEAgEIjfD5B1EAgEAlEdkHUQCAQCUR2QdRAIBAJRHZB1EAgEAlEdkHUQCAQCUR2QdRAIBAJRHZB1EAgE4veCYRzVoubxFb8zateiqBanVbZh81hnMrhuDYh6WT+YKbjuTtXypNuZxeOC5AWZLlpayVn9gP6LdDvm/frBrH4wH4p6xvN6koE1QLjuTgsyXbQ6iwkd6WSmtpnkp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30DOQusWhVZ2U+u/7oC7vagiiDeKpK9q1KjSb1GC+mDDeuGiXXhkhRBit7cdytuq4/Llb1J69AGRTZkwhPeH6Jm6sRB1LKeDb0Z2kKhaIAShkKhaIAShkKhaIAShkKhaIAShkKhaIAShkKhaIAShkKhaIAShkKhUKKH//y26df/vafH376+8u7olAo3hx/+vz7ly9fP3379r9/fv3v57/++8ef//EH5Q6FQgHww/X2x59++/Pn33/+5euXL99+/fVf/wddkz/2mqOFkQAAAABJRU5ErkJggg==" alt="" />
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <stdlib.h>
#include <math.h>
using namespace std;
typedef long long LL;
const int N = ;
int Hash[N],k;
char str[N];
bool judge(){
for(int i=;i<;i++){
if(Hash[i]>k) return false;
}
return true;
}
int main()
{
int tcase;
scanf("%d",&tcase);
while(tcase--){
scanf("%s",str);
scanf("%d",&k);
int len = strlen(str);
memset(Hash,,sizeof(Hash));
int l=,r=;
LL cnt=;
while(r<len){
Hash[str[r]-'a']++;
while(l<len&&!judge()){
Hash[str[l]-'a']--;
l++;
}
if(!judge()) break;
//printf("%d %d\n",l,r);
cnt =cnt+(r-l+);
r++;
}
printf("%lld\n",cnt);
}
return ;
}
- HDU 6205(尺取法)2017 ACM/ICPC Asia Regional Shenyang Online
题目链接 emmmm...思路是群里群巨聊天讲这题是用尺取法.....emmm然后就没难度了,不过时间上3000多,有点.....盗了个低配本的读入挂发现就降到2800左右, 翻了下,发现神犇Clar ...
- POJ 3320 尺取法(基础题)
Jessica's Reading Problem Description Jessica's a very lovely girl wooed by lots of boys. Recently s ...
- HDU 5358 尺取法+枚举
题意:给一个数列,按如下公式求和. 分析:场上做的时候,傻傻以为是线段树,也没想出题者为啥出log2,就是S(i,j) 的二进制表示的位数.只能说我做题依旧太死板,让求和就按规矩求和,多考虑一下就能发 ...
- 【尺取法好题】POJ2566-Bound Found
[题目大意] 给出一个整数列,求一段子序列之和最接近所给出的t.输出该段子序列之和及左右端点. [思路] ……前缀和比较神奇的想法.一般来说,我们必须要保证数列单调性,才能使用尺取法. 预处理出前i个 ...
- poj 2566 Bound Found(尺取法 好题)
Description Signals of most probably extra-terrestrial origin have been received and digitalized by ...
- hdu 2739(尺取法)
Sum of Consecutive Prime Numbers Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 22876 ...
- hdu 5701 中位数计数 思路题
中位数计数 Time Limit: 12000/6000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Subm ...
- Codeforces Round #364 (Div. 2) C. They Are Everywhere 尺取法
C. They Are Everywhere time limit per test 2 seconds memory limit per test 256 megabytes input stand ...
- codeforces #364c They Are Everywhere 尺取法
C. They Are Everywhere time limit per test 2 seconds memory limit per test 256 megabytes input stand ...
随机推荐
- Django配置邮箱登录
1.settings下配置 # AUTH 方法(支持邮箱登录) AUTHENTICATION_BACKENDS = ('users.views.CustomBackend',) 2.views下逻辑如 ...
- B1020 月饼(25 分)
B1020 月饼(25 分) 月饼是中国人在中秋佳节时吃的一种传统食品,不同地区有许多不同风味的月饼.现给定所有种类月饼的库存量.总售价.以及市场的最大需求量,请你计算可以获得的最大收益是多少. 注意 ...
- 动态规划:HDU3496-Watch The Movie(二维费用的背包问题)
Watch The Movie Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/65535 K (Java/Others) ...
- 洛谷 P1736 创意吃鱼法(多维DP)
题目描述 回到家中的猫猫把三桶鱼全部转移到了她那长方形大池子中,然后开始思考:到底要以何种方法吃鱼呢(猫猫就是这么可爱,吃鱼也要想好吃法 ^_*).她发现,把大池子视为01矩阵(0表示对应位置无鱼,1 ...
- javaScripct入门教程
1.JavaScript环境安装 JavaScript是一个轻量级的编程语言,安装自然很简单. a.打开你的电脑,找到一个Web浏览器,再找一个文本编辑器(比如记事本) b.没有了... 2.Java ...
- HDU 1847 Good Luck in CET-4 Everybody!(SG函数)
Good Luck in CET-4 Everybody! Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ...
- mof格式的文件怎么打开?用什么工具?
托管对象格式 (MOF) 文件是创建和注册提供程序.事件类别和事件的简便方法.在 MOF 文件中创建类实例和类定义后,可以对该文件进行编译.有关更多信息,请参见编译托管对象格式 (MOF) 文件.编译 ...
- 【N-Queens】cpp
题目: The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that no two que ...
- [oldboy-django][2深入django]django一个请求的生命周期 + WSGI + 中间件
1 WSGI # WSGI(是一套协议,很多东西比如wsgiref, uwsgiref遵循这一套协议) - django系统本质 别人的socket(wsgiref或者uwsgiref) + djan ...
- TOJ5272: 逆矩阵
5272: 逆矩阵 Time Limit(Common/Java):1000MS/3000MS Memory Limit:65536KByteTotal Submit: 11 ...