![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
oj
夜行少女
阳光最重要hhh
展开
-
#动态规划#UVa 10328 - Coin Toss
https://www.cnblogs.com/staginner/archive/2011/12/16/2290712.htmlhttps://www.bbsmax.com/A/D854437V5E/借鉴了上面两位大佬的,感觉应该是最简单的做法了吧。#include <iostream>#include <cstring>#define mod ...原创 2019-05-18 21:31:01 · 340 阅读 · 1 评论 -
#动态规划#0-1背包问题
转载自:https://blog.csdn.net/weixin_39059738/article/details/79924049 (侵删)博主写的很详细,空间优化的部分,一开始有点不懂,用实际生活去理解一下就懂了。先放第一个,再放第二个……每次放的时候都从大到小遍历所有的空间,这样就可以在前面的基础上决定放不放后面的。逆序原因:https://blog.csdn.net/u0...转载 2019-06-15 19:06:18 · 101 阅读 · 0 评论 -
#动态规划#Hdu 2602 Bone Collector
懵逼树上懵逼果,,,代码中的问号至今不懂。。。。#include <iostream>#include <string.h> using namespace std;const int N = 1010;const int V = 1010;int value[N];int volume[N];int dp[V];int T;int main...原创 2019-06-15 20:46:48 · 67 阅读 · 0 评论 -
#动态规划#Hdu 2955 Robberies
#include <iostream>#include <cstring>using namespace std;const int N = 110;const int M = 110;//目标:价值最大,可能性低于某个值 (容量是总概率)//有两个错误:①求的是被抓概率低于某个值,限制条件和背包总容量不能为同一属性 ②概率是浮点数,无法遍历。//...原创 2019-06-16 08:31:21 · 70 阅读 · 0 评论 -
#动态规划#Poj 2184 Cow Exhibition
#include <iostream>#include <cstring>#define INF 0x3f3f3f using namespace std;//目标:寻找背包容量与价值。//已知:智商+幽默感(看似都是属性,咋整?) 但是0-1背包的特征很明显,对每头牛,取or不取,那每头牛肯定是一个价值量//两个属性,一个做容量,另一个做价值。 最...原创 2019-06-16 14:43:44 · 111 阅读 · 0 评论 -
#回溯法#回溯法+排序树为什么swap?
首先放一个链接记录下回溯法的基本知识:子集树和排序树回溯法详解回溯法为什么要swap呢?这个swap其实是“挪”向了同层的其他节点,但这个地方我们没有建树,直接通过在这条路径上进行swap得到。譬如,一条12345路径,我们从1出发1->2->3->4->5那我们backtrace(2)的时候会把2和345交换位置,就是为了获得1->3...原创 2019-06-17 14:46:28 · 2583 阅读 · 5 评论 -
#动态规划#missing number
#include <iostream>#include <string>#include <vector>#include <algorithm>using namespace std;const int N = 45;string s;int n;//vector<bool> vis(n+1,false); ...原创 2019-06-17 19:05:49 · 82 阅读 · 0 评论 -
#动态规划# hdu-4616-Game(树形dp)
这个题,大佬说是水题,对我这种菜鸡来说,看了好久才懂。。。。#include <iostream>#include <cstring>#include <stdio.h>#include <vector>#define inf 0x3f3f3f3fusing namespace std;/*①如果k==c,那么起点和终...原创 2019-06-30 09:39:50 · 195 阅读 · 2 评论 -
0x3f3f3f3f
一晚上都在找bug,感觉差不多的代码,人家的交上就AC,我的就WA(手动再见),试了一晚上发现,0x3f3f3f3f是可以的,但是0x3f3f3f不行!流泪了。。。。。...原创 2019-06-30 21:46:26 · 325 阅读 · 0 评论