Description ]. Output For each test case, print how many places there are, into which you insert a '(' or ')', can change the sequence to a regular brackets sequence. What's more, you can assume there has at least one such place. Sample Input 4 ) ())…
Description We give the following inductive definition of a “regular brackets” sequence: the empty sequence is a regular brackets sequence, if s is a regular brackets sequence, then (s) and [s] are regular brackets sequences, and if a and b are regul…
题目链接:http://poj.org/problem?id=2955 这题要求求出一段括号序列的最大括号匹配数量 规则如下: the empty sequence is a regular brackets sequence, if s is a regular brackets sequence, then (s) and [s] are regular brackets sequences, and if a and b are regular brackets sequences, th…
冲鸭,去刷题:http://codeforces.com/contest/1153/problem/C C. Serval and Parenthesis Sequence time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Serval soon said goodbye to Japari kindergarten, and b…
Description Sereja has a bracket sequence s1, s2, ..., sn, or, in other words, a string s of length n, consisting of characters "(" and ")". Sereja needs to answer m queries, each of them is described by two integers li, ri(1 ≤ li ≤ ri…