
状态压缩dp
SwustLpf
长得帅~~~
展开
-
poj 2411
http://poj.org/problem?id=2411 /*Óùö¶¯Êý×é*/ #include"iostream" #include"string.h" using namespace std; long long dp[2][(1<<15)]; int N,M; int check1(int x) { for(int j=0;j<M;) {...原创 2018-03-18 19:54:34 · 177 阅读 · 0 评论 -
poj 1038
http://poj.org/problem?id=1038 这题我找Wrong找到想吐了。。。。本来就是看别人的代码,别人的思路写的,感觉都一模一样了,但还是Wrong。我就从别人正确的代码,一个函数一个函数的换成我的函数,wocao,怎么全部搬过来都还是AC了。。。。。。最上面怎么会有问题???难道头文件会Wrong??? 哇~这要是真的的话,那我就发现了什么不得了的事了(〃’▽’〃) ...原创 2018-03-20 16:14:34 · 415 阅读 · 0 评论 -
n皇后方案数
#include"bits/stdc++.h" using namespace std; typedef long long LL; LL ans; //状压每一位表示每一列是否有放 //sta表示当前放了多少个 //ld是副对角线 ,rd是主对角线 LL tot;//tot表示全部都放好了 void dfs(LL sta,LL ld,LL rd) { if(sta==tot) ...原创 2018-07-23 09:47:56 · 552 阅读 · 0 评论 -
poj 3524 Corn Fields
[TOC] 题目链接:http://poj.org/problem?id=3254 取模竟然不是1e9+7。。。。 dp[i][sta]dp[i][sta]dp[i][sta]表示弄到第 iii 层了,stastasta 这种状态的方案数有多少种 还是状压dp的入门题,我太挫了T_T //#include"bits/stdc++.h" #include"iostream" #includ...原创 2018-09-07 19:20:22 · 202 阅读 · 0 评论 -
vijos 1456 最小总代价
最小总代价(vijos 1456) 最小总代价(vijos 1456) 题目链接:https://vijos.org/p/1456 好激动~这道题自己做的~没有看题解~~~ 昨天打完网络赛,有道状压dp的题,lx分分钟把他秒了,而我却感觉很难,就是这道南京的网络赛E题 这题跟网络赛那道还有点不一样,还要记录上一次是从谁那里转移过来的,我就多开了一维,dp[sta][i]d...原创 2018-09-02 09:42:45 · 414 阅读 · 0 评论 -
2014广州站
I-Little Zu Chongzhi’s Triangles I-Little Zu Chongzhi’s Triangles 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5135 这题贪心是错的,但是数据有点水,阔以过,但这组数据就不得行: input: 5 51 13 40 92 45 0 output: ...原创 2018-09-07 09:59:14 · 204 阅读 · 0 评论 -
Codeforce Educational Codeforces Round 51
文章目录D. Bicolorings D. Bicolorings 题目链接:http://codeforces.com/contest/1051/problem/D 这道dp题分类讨论好多啊 dp[i][j][k]dp[i][j][k]dp[i][j][k]表示前 iii 个格子,有jjj个连通块,最后一列的状态是kkk 的方案数 #include"bits/stdc++.h" #define ...原创 2018-09-22 19:57:44 · 220 阅读 · 0 评论