摘要: 原CF 1138A Sushi for Two 基本思路 每个状态之和之前的一个连续状态有关,并且取下限即可,若状态发生改变,计数器置零 c++ include using namespace std; int main() { int n;cin n;int num1=0,num2=0,sum=0 阅读全文
posted @ 2019-07-21 19:45 一块钱的争论 阅读(253) 评论(0) 推荐(0) 编辑
摘要: 基本思路 树形dp入门题,0表示不选中1表示选中。 $$ \begin{array}{l} treedp[u][0]=max(treedp[u.boss][0],treedp[u.boss][1])\\ treedp[u][1]=treedp[u.boss][0]+arr[u]; \end{arra 阅读全文
posted @ 2019-07-21 13:43 一块钱的争论 阅读(104) 评论(0) 推荐(0) 编辑
摘要: 基本思路: 单dfs暴力搜的复杂度为C(2N,N) N^2, N 12会超时,使用两个dfs,并记录过程的累和值将复杂度降低到C(2N,N) N c++ include using namespace std; typedef long long ll; ll arr[30][30],n; ll a 阅读全文
posted @ 2019-07-21 10:38 一块钱的争论 阅读(134) 评论(0) 推荐(0) 编辑