Codeforces Round #436 B. Polycarp and Letters
题意:给你一串长度为n的字符,由大小写字母组成,求连续的小写子串中不同字母个数的最大值。
11
aaaaBaabAbA
2
12
zACaAbbaazzC
3
3
ABC
0 思路:水题,瞎搞搞就OK。 代码:
#include<iostream>
#include<string.h>
#include<cmath>
using namespace std; char s[250];
int vis[30]; int main(){
int l,sum=0,k=0;
cin>>l>>s;
if(l==1){
if(s[0]>='a'&&s[0]<='z')cout<<1<<endl;
else cout<<0<<endl;
return 0;
}
for(int i=0;i<l;i++){
if(s[i]>='A'&&s[i]<='Z'){
memset(vis,0,sizeof(vis));
k=0;
}
else {
if(vis[s[i]-'a']==0){
vis[s[i]-'a']=1;
k++;
sum=max(sum,k);
}
}
}
cout<<sum<<endl;
return 0;
}
Codeforces Round #436 B. Polycarp and Letters的更多相关文章
- Codeforces Round #436 (Div. 2)【A、B、C、D、E】
Codeforces Round #436 (Div. 2) 敲出一身冷汗...感觉自己宛如智障:( codeforces 864 A. Fair Game[水] 题意:已知n为偶数,有n张卡片,每张 ...
- Codeforces Round #436 (Div. 2) A,B,D
A. Fair Game 题目链接:http://codeforces.com/contest/864/problem/A 水题 #include<iostream> #include&l ...
- Codeforces Round #436 (Div. 2) 题解864A 864B 864C 864D 864E 864F
A. Fair Game time limit per test 1 second memory limit per test 256 megabytes input standard input o ...
- Codeforces Round #436 (Div. 2) B. Polycarp and Letters
http://codeforces.com/contest/864/problem/B 题意: 给出一个字符串,要求找到一个集合S,使得从S中选出的所有数,在这些数的位置上的字母全部为小写且是不同的字 ...
- Codeforces Round #436 (Div. 2) C. Bus
http://codeforces.com/contest/864/problem/C 题意: 坐标轴上有x = 0和 x = a两点,汽车从0到a之后掉头返回,从a到0之后又掉头驶向a...从0到a ...
- Codeforces Round #436 (Div. 2) E. Fire
http://codeforces.com/contest/864/problem/E 题意: 有一堆物品,每个物品有3个属性,需要的时间,失效的时间(一开始)和价值.只能一件一件的选择物品(即在选择 ...
- Codeforces Round #436 (Div. 2)
http://codeforces.com/contest/864 第一次打cf的月赛-- A 题意:给你一个数列,问你能不能保证里面只有两种数且个数相等.2<=n<=100,1<= ...
- Codeforces Round #436 (Div. 2) D. Make a Permutation!
http://codeforces.com/contest/864/problem/D 题意: 给出n和n个数(ai <= n),要求改变其中某些数,使得这n个数为1到n的一个排列,首先保证修改 ...
- Codeforces Round #436 (Div. 2)D. Make a Permutation! 模拟
D. Make a Permutation! time limit per test: 2 seconds memory limit per test: 256 megabytes input: st ...
随机推荐
- 如何开发一款html5(H5)跨平台 k12动画/交互课件/游戏
flash交互课件能生动表达教学内容,也深受广大教育工作者的喜爱,但是目前flash课件只能在pc电脑平台上进行展示,且目前苹果公司已经不再支持flash各类产品,也就是后续苹果ios pc系统也已经 ...
- vue 将毫秒转为日期
12345656546 | parseTime('{y}-{m}-{d} {h}:{i}')
- AngularJS 1.x 思维索引
我们在这里不讨论Angular2和Angular4,因为其完全重写,其实已经不叫AngularJS了. AngularJS的缺陷: 性能问题:通过检查脏值进行数据更新,当数据不断增加时,检查的效率就不 ...
- kibi - join and filter data from multiple Elasticsearch indexes
Kibi extends Kibana 4.6.4 with data intelligence features. The core feature of Kibi is the capabilit ...
- 发现一个非常有趣好用的git博主,收录热门OC、swift项目三方架构
日常学习: https://github.com/iOShuyang/Book-Recommend-Github
- 基于consul高可用
1.介绍consul Consul 是一个支持多数据中心分布式高可用的服务发现和配置共享的服务软件,由 HashiCorp 公司用 Go 语言开发, 基于 Mozilla Public License ...
- Linux文件与目录管理(学习笔记)
本笔记为<鸟哥linux私房菜>第六章学习笔记 一.目录与路径 相对路径与绝对路径 绝对路径:一定由根目录 / 写起 正确度比较好 相对路径:不是由 / 写起 ...
- Winform 实现跨线程以及Timer
https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.process.exited?redirectedfrom=MSDN&am ...
- Python中的取模运算
C++中的取模运算符%只能对整数使用(如果要对浮点数使用需要fmod),Python则不同,对整数或浮点数均有效. 在这里再介绍一下取模的定义:假设a,b两个数,那么a mod b = a - n*b ...
- Ubuntu中通过SuperVisor添加守护进程
1. 用途 守护进程用于保持一个指定程序(dll)时刻保持运行.在命令行终端中通过dotnet run命令执行的程序,在退出命令行终端后,程序自动终止.添加守护进程后,即使终端退出,程序仍可后台执行. ...