Bobo has a balanced parenthesis sequence P=p 1 p 2…p n of length n and q questions. The i-th question is whether P remains balanced after p ai and p bi swapped. Note that questions are individual so that they have no affect on others. Parenthesis se…
题目地址:http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1803 Knowledge Point: 同余定理:两个整数a.b,若它们除以整数m所得的余数相等,则称a与b对模m同余或a同余于b模m.记作 a≡b(mod m): 加法运用: (a + b) % m = (a % m + b % m) % m 乘法运用: (a * b) % m = ((a % m) * (b % m)) % m 高精度取模: 一个高精度数对一个数取余,可以把高精…
Description Bobo has a balanced parenthesis sequence P=p1 p2…pn of length n and q questions. The i-th question is whether P remains balanced after pai and pbi swapped. Note that questions are individual so that they have no affect on others. Parenth…