08 2013 档案

NYoj 155最短路
摘要:1 //dij 2 #include 3 4 #include 5 #include 6 using namespace std; 7 #define inf 0x3f3f3f3f 8 #define min(x,y) (x<y?x:y) 9 10 int N,M,P,Q;11 int city... 阅读全文

posted @ 2013-08-31 22:24 Stomach_ache 阅读(115) 评论(0) 推荐(0) 编辑

HDU 2686 双进程DP
摘要:1 //第一次遇到这种DP,看大牛的博客都是用最大流求解的。。。dp[k][i][j] 表示走k步,第一条路线横向走了i步,第二条路线横向走了j步,所获得的最大值。。 2 3 //转移方程也很好想 4 #include 5 6 #include 7 #define Max(x,y) (x>y... 阅读全文

posted @ 2013-08-28 16:33 Stomach_ache 阅读(140) 评论(0) 推荐(0) 编辑

HDU 4006优先队列
摘要:1 //按照降序排列,而且队列中只保存k个元素 2 3 #include 4 5 #include 6 using namespace std; 7 8 int main(){ 9 int n,k;10 while(~scanf("%d%d",&n,&k)){11 ... 阅读全文

posted @ 2013-08-27 20:44 Stomach_ache 阅读(112) 评论(0) 推荐(0) 编辑

HDU 4022 STL
摘要:1 // 使用map > 实现一对多,因为会有重点,所以用multimap 2 3 4 #include 5 6 #include 7 #include 8 #include 9 using namespace std;10 11 map > cnt_x,cnt_y;12 13 int ma... 阅读全文

posted @ 2013-08-27 20:01 Stomach_ache 阅读(135) 评论(0) 推荐(0) 编辑

HDU 2639 第K大背包问题
摘要:1 //状态方程和01背包类似,dp[j][k]表示背包容量为j的第k大背包的值。。。。。。。。。。 2 3 //应当注意的是此时dp[j][1.....k]应当是递减的。。。。。。。。。。。。。。。。。。。。 4 5 6 #include 7 8 #include 9 #define M... 阅读全文

posted @ 2013-08-21 13:47 Stomach_ache 阅读(152) 评论(0) 推荐(0) 编辑

HDU 2196
摘要:1 //树形DP,求树的最大直径。。。。 2 #include 3 4 #include 5 #include 6 using namespace std; 7 #define Max(x,y) (x>y?x:y) 8 #define max 10000+5 9 10 vector next[m... 阅读全文

posted @ 2013-08-12 18:50 Stomach_ache 阅读(157) 评论(0) 推荐(0) 编辑

HDU 3853
摘要:1 // 第一次做概率DP,根本不懂。。。看了题解还是不懂。尼马!!!!!! 2 3 //只是听人家说什么求概率要正推,求期望要逆推。。。尼马还是不懂!!!! 4 5 //于是找了个水题做了一个,特么的还是不懂!!!! 6 7 //这是个开始,,,慢慢来 8 。。。。。。。。。。。。。。。。... 阅读全文

posted @ 2013-08-12 18:49 Stomach_ache 阅读(263) 评论(0) 推荐(0) 编辑

HDU 3555 (递推&&记忆化)
摘要:#include#include#define max 25typedef __int64 LL;LL dp[max][3];//dp[i][0] 不含49//dp[i][1] 不含49但最高位为9//dp[i][2] 含49void init(){ memset(dp,0,sizeof... 阅读全文

posted @ 2013-08-11 15:15 Stomach_ache 阅读(124) 评论(0) 推荐(0) 编辑

HDU 4585
摘要:1 //也是个水题,不过以前没用过set。。。。所以逼着我去学。 2 3 4 5 #include 6 #include 7 #include 8 #include 9 #include10 #include11 #include12 using namespace std;13 14 se... 阅读全文

posted @ 2013-08-10 20:01 Stomach_ache 阅读(120) 评论(0) 推荐(0) 编辑

HDU 4584
摘要:1 //也是简单题,因为n太小,故暴力之! 2 3 4 #include 5 #include 6 #include 7 #define max 45 8 9 char map[max][max];10 11 int dis(int x1,int y1,int x2,int y2){12 ... 阅读全文

posted @ 2013-08-10 20:00 Stomach_ache 阅读(115) 评论(0) 推荐(0) 编辑

HDU 4576 Robot
摘要://题目并不算难,但是特么的就是坑死你。。。//用数组a[]维护每轮的结果,a[i]就是代表走到i的概率。。。还需借助辅助数组q[]。#include#include#define max 205int n,m,l,r;double q[max],a[max];int main(){ while(s... 阅读全文

posted @ 2013-08-10 19:58 Stomach_ache 阅读(108) 评论(0) 推荐(0) 编辑

HDU 3714
摘要:1 最大值最小问题,三分。。。。竟然排第六当时。。。。。 2 #include 3 4 #include 5 #define max 10000+10 6 #define Max(x,y) (x>y?x:y) 7 #define Min(x,y) (xinf){35 do... 阅读全文

posted @ 2013-08-08 20:02 Stomach_ache 阅读(202) 评论(0) 推荐(0) 编辑

POJ 1011
摘要:做了这题,才知道剪枝的厉害。。。正要的剪枝:如果当前木棍能恰好填满一根原始木棍,但因剩余的木棍无法组合出合法解而返回,那么让我们考虑接下来的两种策略,一是用更长的木棍来代替当前木棍,显然这样总长度会超过原始木棍的长度,违法。二是用更短的木棍组合来代替这根木棍,他们的总长恰好是当前木棍的长度,但是由于... 阅读全文

posted @ 2013-08-08 18:48 Stomach_ache 阅读(148) 评论(0) 推荐(0) 编辑

hdu 1505 && hdu1506 &&hdu 2830 && 2870 总结---------DP之状图选最大矩形
摘要:/*多谢了“闭眼,睁眼” 同学给我一套dp专题,不然真是没接触过这种题型。做个4个简单的,很高兴有所收获。2013-08-06/*HDU 1506最基础的一道题目,其主要精髓就在于两个数组 l[i],r[i];其中,l[i]用来存储第i个矩形的左边界,r[i]存储的是第i个矩形的右边界,也就是说对于... 阅读全文

posted @ 2013-08-06 19:06 Stomach_ache 阅读(235) 评论(0) 推荐(0) 编辑

hdu 1058
摘要:通过此题有两个收获:第一-----------------序数词的正确拼写。第二----------------学会了map的基本使用方法。 ------------------------------------------------------------------------------... 阅读全文

posted @ 2013-08-04 20:59 Stomach_ache 阅读(140) 评论(0) 推荐(0) 编辑

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8

导航

统计

点击右上角即可分享
微信分享提示