文件名称:bracket
介绍说明--下载内容均来自于网络,请自行研究使用
括号字符串
一个合法的括号字符串,需满足下列情况之一
该字符串为”()”
该字符串可视作两个合法括号字符串顺序拼接,如”(())()”
该字符串形如”(+任意合法字符串+)”,如”(()())”
现在给定一个括号字符串,有一些位子的字符被’?’代替,这些问号可以任意填写为一个’(‘或者’)’,求把这个字符串填写为合法括号字符串的方法数。
【输入】
输入仅包含一个字符串,由括号与问号组成。
【输出】
输出合法字符串个数模上1000000007。
【输入样例】(???
【输出样例】2
【样例解释】
(())和()()
【数据规模】
对于50 的数据,字符串长不超过100,问号个数不超过20
对于所有数据,字符串长不超过1000。-The brackets string bracket.cpp of a legitimate brackets string, the string must meet one of the following conditions for legal brackets " ()" The string is treated as two string sequence splicing, such as " (()) () " the string-shaped (+ any legal string PPLS)" , " (() ())" given a brace string seat characters ? instead of the question mark optional a ( or ) , seeking to fill the string is legal in parentheses string number of ways. [Input] Enter only contains a string composed of brackets with a question mark. Output Output number of legitimate string mode on 1000000007. Input sample (??? [Output sample 2 sample interpretation] (()) () () [data size] 50 of the data, the string length is not more than 100, the number of question marks do not more than 20 for all of the data string length does not exceed 1000.
一个合法的括号字符串,需满足下列情况之一
该字符串为”()”
该字符串可视作两个合法括号字符串顺序拼接,如”(())()”
该字符串形如”(+任意合法字符串+)”,如”(()())”
现在给定一个括号字符串,有一些位子的字符被’?’代替,这些问号可以任意填写为一个’(‘或者’)’,求把这个字符串填写为合法括号字符串的方法数。
【输入】
输入仅包含一个字符串,由括号与问号组成。
【输出】
输出合法字符串个数模上1000000007。
【输入样例】(???
【输出样例】2
【样例解释】
(())和()()
【数据规模】
对于50 的数据,字符串长不超过100,问号个数不超过20
对于所有数据,字符串长不超过1000。-The brackets string bracket.cpp of a legitimate brackets string, the string must meet one of the following conditions for legal brackets " ()" The string is treated as two string sequence splicing, such as " (()) () " the string-shaped (+ any legal string PPLS)" , " (() ())" given a brace string seat characters ? instead of the question mark optional a ( or ) , seeking to fill the string is legal in parentheses string number of ways. [Input] Enter only contains a string composed of brackets with a question mark. Output Output number of legitimate string mode on 1000000007. Input sample (??? [Output sample 2 sample interpretation] (()) () () [data size] 50 of the data, the string length is not more than 100, the number of question marks do not more than 20 for all of the data string length does not exceed 1000.
(系统自动生成,下载前可以参看下载内容)
下载文件列表
bracket.cpp
bracket.doc