zoukankan      html  css  js  c++  java
  • CF 917A The Monster 【括号匹配】

    【链接】:CF

    Examples
    inputCopy
    ((?))
    outputCopy
    4
    inputCopy
    ??()??
    outputCopy
    7
    
    说明
    For the first sample testcase, the pretty substrings of s s are:
    
    "(?" which can be transformed to "()".
    "?)" which can be transformed to "()".
    "((?)" which can be transformed to "(())".
    "(?))" which can be transformed to "(())".
    For the second sample testcase, the pretty substrings of s s are:
    
    "??" which can be transformed to "()".
    "()".
    "??()" which can be transformed to "()()".
    "?()?" which can be transformed to "(())".
    "??" which can be transformed to "()".
    "()??" which can be transformed to "()()".
    "??()??" which can be transformed to "()()()".
    

    【题意】:
    给你一个字符串只包含'(' 、‘ )’ 、‘ ?’三种字符,?你可以按需求转换成‘(’或’)‘
    定义一个区间为正确的括号序列,当且仅当对该区间进行如下操作之后,该序列为空:每次删除序列中一对相邻的左右括号(),直到删到不能再删
    Input
    一个长度不超过5000的字符串
    Output
    能转换成正确的括号序列的子区间数量
    【分析】:
    【代码】:

  • 相关阅读:
    BZOJ 3677: [Apio2014]连珠线 树形DP
    TweenMax说明
    vs 中快捷实现父类方法
    Box2d b2World的RayCast方法
    cocos2d-js 帧序列动画
    cocos2d-js 显示帧序列图中的一帧
    不同类型刚体接触测试
    FlashDevelop调试Air出错
    php 创建删除数据库
    本地php 连接 MySQL
  • 原文地址:https://www.cnblogs.com/Roni-i/p/9215580.html
Copyright © 2011-2022 走看看