zoukankan      html  css  js  c++  java
  • hzau 1207 Candies

    1207: Candies

    Time Limit: 2 Sec  Memory Limit: 1280 MB
    Submit: 223  Solved: 31
    [Submit][Status][Web Board]

    Description

         Xiao Ming likes those N candies he collects very much. There are two kinds of candies, A and B. One day, Xiao Ming puts his candies in a row and plays games. And he can replace the Lth candy to the Rth candy with the same kind of candies. Now, he wonder that if he eats the Lth candy to Rth candy, he can eat how many B candy continuously at most. For each Xiao Ming’s query, give the number of the B candy he can eat continuously at most. 

    Input

         In the first line, there is an integer T, indicates the number of test cases.

         For each case, there are two integers N and M in the first line, indicate the number of candies and the time of Xiao Ming’s operations.

         The second line is a N-length string consist of character A and B, indicates the row of candies Xiao Ming put.

         The next M line is Xiao Ming’s operations. There are two kind of operations:

              1. 1 L R v, indicate Xiao Ming replaces the Lth candy to the Rth candy with A candies (v==1) or B candies ( v == 2 ).

              2. 2 L R, indicate Xiao Ming wonder that there are how many continuous B candies between the Lth candy to the Rth candy most. 

    Output

           In each case, the first line is “Case #k: “, k indicates the case number.

          For each query, output the number of the most continuous B candies. 

    Sample Input

    1
    5 3
    ABABB
    2 1 3
    1 2 3 2
    2 1 3
    

    Sample Output

    Case #1:
    1
    2
    

    HINT

  • 相关阅读:
    linux服务 ssh
    详细教你两台电脑之间传文件
    openstack之keystone
    Token
    mybatis返回刚刚插入数据的自增长的id值
    事务配置在applicationContext.xml文件中不起作用,控制不了异常回滚
    SSM框架整合
    ssm框架的小总结
    spring_mvc入门项目的小总结
    tcp和udp的网络编程(发送消息及回复)
  • 原文地址:https://www.cnblogs.com/gongpixin/p/6790510.html
Copyright © 2011-2022 走看看