CF5C--Longest Regular Bracket Sequence翻译

原题链接--

https://acs.jxnu.edu.cn/problem/CF5Cicon-default.png?t=M0H8https://acs.jxnu.edu.cn/problem/CF5C 

Longest Regular Bracket Sequence

 2000ms  262144K

描述:

This is yet another problem dealing with regular bracket sequences.

We should remind you that a bracket sequence is called regular, if by inserting «+» and «1» into it we can get a correct mathematical expression. For example, sequences «(())()», «()» and «(()(()))» are regular, while «)(», «(()» and «(()))(» are not.

You are given a string of «(» and «)» characters. You are to find its longest substring that is a regular bracket sequence. You are to find the number of such substrings as well.

译文:这是另一个处理规则括号序列的问题。

我们应该提醒你一个括号序列被称作规则,如果通过插入«+»和«1»我们能得到一个正确的数学表达式。举个例子,序列 «(())()», «()»和«(()(()))»是规则的,但是«)(», «(()»和«(()))(»不是。

你是被给一个«(»和«)»字符组成的字符串。你要找到一个是规则括号序列的最长子串。你也要找到这样的子串的数量。

输入:

The first line of the input file contains a non-empty string, consisting of «(» and «)» characters. Its length does not exceed 106.

译文:第一行输入文件包含一个非空字符串,由«(»和«)»组成。它的长度不超过106。

输出:

Print the length of the longest substring that is a regular bracket sequence, and the number of such substrings. If there are no such substrings, write the only line containing "0 1".

译文:输出是规则括号序列最长子串的长度,和这样的子串的数量。如果没有这样的子串,只写一行包含"0 1"。

样例输入:

)((())))(()())

样例输出:

6 2

样例输入:

))(

样例输出:

0 1
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值