Description The 11th Zhejiang Provincial Collegiate Programming Contest is coming! As a problem setter, Edward is going to arrange the order of the problems. As we know, the arrangement will have a great effect on the result of the contest. For examp…
Problem Description Teacher Mai has n numbers a1,a2,⋯,an and n−1 operators("+", "-" or "*")op1,op2,⋯,opn−1 , which are arranged in the form a1 op1 a2 op2 a3 ⋯ an . He wants to erase numbers one by one. In i -th round, there a…
这个题目由于只有16个城市,很容易想到去用状压来保存状态. p[i][state]表示到i城市经过state状态的城市的最优值(state的二进制位每一位为1表示经过了该城市,否则没经过) 这样p[j][state|(1<<i)] = min(p[i][state]+dis[i][j])了 方程出来了不会遍历,打BC的时候,一开始用dfs遍历T了一发.后来换成SPFA了,不过当时脑子昏了,竟然忘记对队列里的数进行判重了,不过终测竟然没过,去HDU上用G++交是可以AC的.. 可能是不判重,SP…
Description The 11th Zhejiang Provincial Collegiate Programming Contest is coming! As a problem setter, Edward is going to arrange the order of the problems. As we know, the arrangement will have a great effect on the result of the contest. For examp…
ZOJ - 3777 就是一个入门状压dp期望 dp[i][j] 当前状态为i,分数为j时的情况数然后看代码 有注释 #include <iostream> #include <cstdio> #include <sstream> #include <cstring> #include <map> #include <cctype> #include <set> #include <vector> #inclu…
题目:uva10401Injured Queen Problem(递推) 题目大意:依然是在棋盘上放皇后的问题,这些皇后是受伤的皇后,攻击范围缩小了.攻击范围在图中用阴影表示(题目).然后给出棋盘的现状,???3?4:在一个6*6的棋盘上,由于皇后是能够列向攻击的,所以一列仅仅能放一个皇后,所以第一个?代表第一列的皇后放的行未知,这样3的意思就是第4列皇后在第三行.也就是确定了第4列皇后的位置. 要求棋盘上的皇后不互相攻击.问这种棋盘能够有多少不同的放法. 解题思路:一開始想状态.想把不同的棋盘…
Description Assuming a finite – radius “ball” which is on an N dimension is cut with a “knife” of N-1 dimension. How many pieces will the “ball” be cut into most?However, it’s impossible to understand the following statement without any explanation.L…
题目链接:http://acm.uestc.edu.cn/#/problem/show/1217 题目大意就是求一个序列里面长度为m的递增子序列的个数. 首先可以列出一个递推式p(len, i) = sum(p(len-1, j)) (a[j] < a[i]) p(len, i)表示以第i个结尾的长度为len的子序列的个数. 但是如果按照递增子序列的思想,然后直接弄的话,复杂度是n*m*n的. 如果需要优化的话,可以优化的地方就是那个求sum的过程. 把p数组映射到树状数组,那么求和的过程就能在…
Description "Well, it seems the first problem is too easy. I will let you know how foolish you are later." feng5166 says. "The second problem is, given an positive integer N, we define an equation like this:   N=a[1]+a[2]+a[3]+...+a[m];   a…
Problem Description It’s an interesting experience to move from ICPC to work, end my college life and start a brand new journey in company.As is known to all, every stuff in a company has a title, everyone except the boss has a direct leader, and all…