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
    能转换成正确的括号序列的子区间数量
    【分析】:
    【代码】:

  • 相关阅读:
    数字货币交易所数据标准格式
    Python3量化技术常用插件
    线上线下流量趋势
    数字货币做市技术——随机价格
    OKEX API v1 SDK基于 Python 实现
    CEOBI交易所接口文档
    递归拉取订单列表的方法
    XT交易所Websocket API
    XT交易所API
    获取合约日期
  • 原文地址:https://www.cnblogs.com/Roni-i/p/9215580.html
Copyright © 2011-2022 走看看