随笔分类 -  DP

摘要:#include#include#include#includeusing namespace std;double p[1010][1010][5];double dp[1010][1010];int n,m;void fun(){ int i,j,k; for(i=n;i>=1;i-... 阅读全文
posted @ 2015-08-12 16:48 sola94 阅读(109) 评论(0) 推荐(0) 编辑
摘要:#include #include #include using namespace std;int hp1 , hp2 ;double dp[2][2100] ;double a , b , p ;double ka[10] , kb[10] ;int main(){ int i , j ,... 阅读全文
posted @ 2015-08-11 22:30 sola94 阅读(159) 评论(0) 推荐(0) 编辑
摘要:#include #include #include #include #include #include #include #define lson l,mid,os2[j]&&maxxans) ans=dp[j]; } printf("%d\n",ans); }... 阅读全文
posted @ 2015-08-09 22:32 sola94 阅读(125) 评论(0) 推荐(0) 编辑
摘要:#include#include#include#include#include#define INF 30000000#define pai 3.1415926using namespace std;char s1[1000],s2[1000];int dp[1000][1000];int mai... 阅读全文
posted @ 2015-08-06 21:32 sola94 阅读(106) 评论(0) 推荐(0) 编辑
摘要:#include#include#include#includeusing namespace std;int fa[7000];int dp[7000][5];int vis[7000];int n;void dfs(int rt){ int i,j,k; vis[rt]=1; ... 阅读全文
posted @ 2015-08-01 20:35 sola94 阅读(77) 评论(0) 推荐(0) 编辑
摘要:#include#include#include#include#includeusing namespace std;int v[200],c[200];int dp[30000];int main(){ int n,t; int i,j,k; int cas=1; whi... 阅读全文
posted @ 2015-07-31 01:45 sola94 阅读(145) 评论(0) 推荐(0) 编辑
摘要:母函数#include#include#include#include#includeusing namespace std;int dp[50];struct Clas{ int v,c;};Clas cla[50];int c1[500000];int c2[500000];int t,n... 阅读全文
posted @ 2015-07-30 16:53 sola94 阅读(163) 评论(0) 推荐(0) 编辑
摘要:#include#include#includeusing namespace std;int mat[200][200];int dp[200];int vis[200];int n;int dfs(int x){ //printf("%d........\n",x); int i,j... 阅读全文
posted @ 2015-07-30 11:20 sola94 阅读(126) 评论(0) 推荐(0) 编辑
摘要:#include#include#include#includeusing namespace std;struct Coin{ int v,c;};Coin coin[200];int dp[100000+100];int main(){ int t,n,m; int p,h,c; ... 阅读全文
posted @ 2015-07-29 15:15 sola94 阅读(114) 评论(0) 推荐(0) 编辑
摘要:转化为01背包#include#include#include#includeusing namespace std;struct Rice{ int v,w,c;};Rice r[120];int dp[50000];int main(){ int t,n,m; int p,h,... 阅读全文
posted @ 2015-07-29 13:10 sola94 阅读(183) 评论(0) 推荐(0) 编辑
摘要:#include#include#include#includeusing namespace std;int a[200][200];int dp[200];int main(){ int n,m; int i,j,k; while(scanf("%d%d",&n,&m)!=EO... 阅读全文
posted @ 2015-07-28 21:28 sola94 阅读(111) 评论(0) 推荐(0) 编辑
摘要:题意:有1 5 10 25 50 五种硬币 最多取100个 问有多少种方式能凑成 n思路:dp#include#include#include#include#includeusing namespace std;int op[10]={1,5,10,25,50};int dp[300][300... 阅读全文
posted @ 2015-07-27 23:07 sola94 阅读(107) 评论(0) 推荐(0) 编辑
摘要:题意:有n种物品 每种价值 vi 有 ci件 问分成两堆 最平均的价值分配是多少 思路:01背包#include#include#include#include#includeusing namespace std;int v[100],m[100];int dp[300000];int main(... 阅读全文
posted @ 2015-07-27 20:30 sola94 阅读(130) 评论(0) 推荐(0) 编辑
摘要:#include#include#include#include#includeusing namespace std;int dp[30][30][30][30];int vis[30][30][30][30];int a[2][30],sum[2][30];int dfs(int i,int j... 阅读全文
posted @ 2015-07-11 23:38 sola94 阅读(92) 评论(0) 推荐(0) 编辑
摘要:#include#include#include#include#includeusing namespace std;int a[100+10];int dp[120][120];int sum[120];int vis[120][120];int dfs(int f,int t){ int ... 阅读全文
posted @ 2015-07-10 00:30 sola94 阅读(114) 评论(0) 推荐(0) 编辑
摘要:题意:思路:#include#include#include#include#includeusing namespace std;int a[200];int dp1[1000+10];int dp2[1000+10];int main(){ int t,n; int i,j,k; ... 阅读全文
posted @ 2015-06-10 05:02 sola94 阅读(174) 评论(0) 推荐(0) 编辑
摘要:题意:思路:#include#include#include#includeusing namespace std;double dp[3][300];int main(){ int n,m; int l,r; int i,j,k; double ans; int te... 阅读全文
posted @ 2015-06-04 20:09 sola94 阅读(114) 评论(0) 推荐(0) 编辑
摘要:题意:http://acm.hdu.edu.cn/showproblem.php?pid=2089思路:首先初始化预处理dp[i][j] 及i位数当前位为j时 即 0到 i * 10^j 符合条件的数 然后求出 fun(r+1)-fun(l) fun从大的位数开始计算#include#include... 阅读全文
posted @ 2015-05-28 19:01 sola94 阅读(97) 评论(0) 推荐(0) 编辑
摘要:题意:有一个排n个建筑 每个高不定 现在要消去全部建筑 方法有两种 1 消去高度为某值的全部方块 2 消去一整个建筑 问 如何通过最少步骤消去思路:首先将数组从大到小排序 if(i+a[i]#include#includeusing namespace ... 阅读全文
posted @ 2015-05-05 21:30 sola94 阅读(128) 评论(0) 推荐(0) 编辑
摘要:#include#include#include#include#include#include#includeusing namespace std;int a[1000000+10];char str[1000000+10];int main(){ int n; int i,j,k;... 阅读全文
posted @ 2015-04-20 09:35 sola94 阅读(117) 评论(0) 推荐(0) 编辑

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