链接:http://codeforces.com/contest/612/
A题:
枚举切多少个p,看剩下的能否整除q。
B题:
从1到n模拟一下,累加移动的距离。
C题:
先用括号匹配的思路看是否有解(所有左括号看做一样,所有右括号看做一样)。
如果有解,就从左到右扫描,记录一个栈,遇到跟栈顶不匹配的右括号就替换一次。
D题:
扫描线做一遍得到初步结果。然后合并一下初步结果得到最终结果。
E题:
一个排列可以看成若干个环,一个排列的平方就是,奇数长度的环做了一次置换,偶数长度的环拆成了两个。所以一个排列的开方就是,奇数长度的置换,偶数长度的匹配合并。
F题:
待补。