题意:给你一串长度为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. sum(case when ct.tradeTotal >= 0 then 1 else 0 end)的意思

    String hql = "select new com.ks.admin.report.dto.ReportMonthWithDrawalDto(" + "count( ...

  2. mysql 8.0 主从复制的优化

    mysql 8.0复制改进一简介: 基于GTID下的并行复制,本文不考虑MGR架构二 主要特性   1 基于writeset的下的改进型并行复制     我在之前的一篇文章关于并行复制中详细的介绍了关 ...

  3. MVC5 方法扩展

    public static MvcHtmlString DataDictionaryDropDownList(this HtmlHelper htmlHelper, string name, obje ...

  4. DiscuzX2.5,X3.0,X3.1,X3.2完整目录结构【模板目录template】

    /template/default/common  公共模板目录全局加载 block_forumtree.htm  DIY论坛树形列表模块 block_thread.htm  DIY帖子模块调用文件 ...

  5. LAB1 partI

    序言 1. master.go 可以正常调用Distributed() 和 Sequential(). Sequential 顺序执行主要用于调试. 2. master : 创建一个 RPC serv ...

  6. 从9x9矩阵中抽取中间菱形区域打印 - perl

    起因: 源自于c的练习题,打印diamond,因为perl不需编译,方便调试,故先用perl实现一下 关键: 没有想到好的思路,只能借助于上一篇打印上下三角矩阵的方法,把菱形拆成上下左右4个三角矩阵区 ...

  7. Galaxy2D Game Engine 4.2 开发版发布

    Update: ◆删除Graph_GetRenderTarget()函数,添加Graph_CopyBackBuffer()/Graph_CopyRanderTarget()函数 ◆Graph_EndS ...

  8. [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher 问题--MyEclipse设置JDK版本

    org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML doc ...

  9. mybatis逆向工程没有报错,但是也没有pojo和Mapper文件问题

    如果你使用的逆向工程是自己手写上去的配置文件,那么错误的范围就太大了.如果是你导入以前使用过的逆向工程,那么没有生成文件很可能是使用的操作系统不同. 原因:逆向工程中的路径问题,windows和mac ...

  10. linux centos 中访问linux 共享文件方法

    mount -t cifs -o username="administrator",password="" //192.168.1.101/cp /mnt/nt ...