题意:给你一串长度为n的字符,由大小写字母组成,求连续的小写子串中不同字母个数的最大值。

Input
11
aaaaBaabAbA
Output
2
Input
12
zACaAbbaazzC
Output
3
Input
3
ABC
Output
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的更多相关文章

  1. Codeforces Round #436 (Div. 2)【A、B、C、D、E】

    Codeforces Round #436 (Div. 2) 敲出一身冷汗...感觉自己宛如智障:( codeforces 864 A. Fair Game[水] 题意:已知n为偶数,有n张卡片,每张 ...

  2. Codeforces Round #436 (Div. 2) A,B,D

    A. Fair Game 题目链接:http://codeforces.com/contest/864/problem/A 水题 #include<iostream> #include&l ...

  3. 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 ...

  4. Codeforces Round #436 (Div. 2) B. Polycarp and Letters

    http://codeforces.com/contest/864/problem/B 题意: 给出一个字符串,要求找到一个集合S,使得从S中选出的所有数,在这些数的位置上的字母全部为小写且是不同的字 ...

  5. 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 ...

  6. Codeforces Round #436 (Div. 2) E. Fire

    http://codeforces.com/contest/864/problem/E 题意: 有一堆物品,每个物品有3个属性,需要的时间,失效的时间(一开始)和价值.只能一件一件的选择物品(即在选择 ...

  7. Codeforces Round #436 (Div. 2)

    http://codeforces.com/contest/864 第一次打cf的月赛-- A 题意:给你一个数列,问你能不能保证里面只有两种数且个数相等.2<=n<=100,1<= ...

  8. Codeforces Round #436 (Div. 2) D. Make a Permutation!

    http://codeforces.com/contest/864/problem/D 题意: 给出n和n个数(ai <= n),要求改变其中某些数,使得这n个数为1到n的一个排列,首先保证修改 ...

  9. 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 ...

随机推荐

  1. Windos下pip配置豆瓣源

    C:\Users\liche\pip 下创建pip.ini文件 pip.ini [global] index-url = http://pypi.douban.com/simple [install] ...

  2. mi家前端面经

    已经好久没想写面经了……菜鸟面到生无可恋. 1.用CSS实现下面圆形 答案: <!DOCTYPE html> <html> <head> <style typ ...

  3. 批量删除ppt动画

    alt+F11打开宏编辑窗口,输入以下代码,运行即可: Sub removeALL() Dim I As Integer: Dim J As Integer Dim oActivePres As Ob ...

  4. .NET Windows服务开发流程

    前段时间做一个数据迁移项目,刚开始用B/S架构做的项目,但B/S要寄存在IIs中,而IIs又不稳定因素,如果重启IIs就要打开页面才能运行项目.有不便之处,就改用Windows服务实现.这篇就总结下, ...

  5. 同一主机设置多个密钥与不同github账号关联,或同一主机同一密钥分别关联github和gitlab

    前言 github一把公钥只能用于一个github账户,如果想在同一主机上给两个属于不同账户的仓库提交时,必须在本地创建两对公/私钥匙,分别把两把公钥给两个帐号. 或者有时候,你公司内部使用的gitl ...

  6. selenium 目录结构解释

    common目录         定义了通用的异常类 webdriver目录 android.backberry.chrome.edge.firefox.ie.opera.phantomjs.safa ...

  7. com.jakewharton:butterknife:7.0.1' 点击无效

    需要加上 annotationProcessor 'com.jakewharton:butterknife:7.0.1' dependencies { compile 'com.jakewharton ...

  8. 设置 P2415Q & P2715Q 显示器使其支持 HDMI 2.0 启用 4k@60hz

    简介:2016 年 2 月后购买的 Dell P2415Q 和 P2715Q 显示器,支持 HDMI 2.0,但是默认启用的是 HDMI 1.4. HDMI 2.0 默认没有启用 Dell P2415 ...

  9. navicat 导入execl失败

    在使用navicat导入execl是遇到了如下图的错误 在更换多个版本的navicat后问题依然如故. 解决办法; 1.打开需要导入的execl 2.安装一个AccessDatabaseEngine_ ...

  10. ionic2 vscode运行调试

    一.环境搭建 1,安装ripple模拟器 如果已经注册了淘宝国内镜像使用下面命令 cnpm install -g ripple-emulator 显示结果如下: 2,安装vs code 下载地址htt ...