传送门 看这个n<=15本以为是个状压DP 还是too young 这个题最神奇的地方是加括号是根据贪心的策略. 发现只有在一连串的加号两边加上括号才是最优的(想一想,为什么?) f[i][j]表示前i个数加j个乘号的最优解 #include <cstdio> #define max(x, y) ((x) > (y) ? (x) : (y)) int n, m; int f[20][20]; int main() { int i, j, k, x; scanf("%d %…
题目链接 http://vjudge.net/contest/132391#problem/G Description standard input/outputStatements — It' s a good game, — Princess said pensively. It was clear that she was thinking about something else. — They like to play various games here in Castles Val…
题目链接 http://acm.split.hdu.edu.cn/showproblem.php?pid=5396 Problem Description Teacher Mai has n numbers a1,a2,⋯,anand n−1 operators("+", "-" or "*")op1,op2,⋯,opn−1, which are arranged in the form a1 op1 a2 op2 a3 ⋯ an. He wan…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2829 T. E. Lawrence was a controversial figure during World War I. He was a British officer who served in the Arabian theater and led a group of Arab nationals in guerilla strikes against the Ottoman Emp…