dp
qdu_ellery
我有梦想啊!
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
LightOj 1422 Halloween Costumes 两种姿势详解(区间DP)
#include<iostream>#include<string.h>using namespace std;int a[200];int dp[200][200];int main(){ int t;cin>>t; int cn=1; while(t--){ memset(dp,0,sizeof(dp)); int n;scanf(...原创 2019-05-02 01:15:24 · 140 阅读 · 0 评论 -
A - Easy Game(dp)(记忆化搜索)(博弈)
You are playing a two player game. Initially there are n integer numbers in an array and player A and B get chance to take them alternatively. Each player can take one or more numbers from the left or...原创 2019-07-24 12:25:52 · 190 阅读 · 0 评论 -
The Staircases(dp)(思维)
One curious child has a set of N little bricks. From these bricks he builds different staircases. Staircase consists of steps of different sizes in a strictly descending order. It is not allowed for s...原创 2019-07-22 13:02:26 · 325 阅读 · 4 评论 -
G - Classy Numbers CodeForces - 1036C (数位dp模板)
Let’s call some positive integer classy if its decimal representation contains no more than 3 non-zero digits. For example, numbers 4, 200000, 10203 are classy and numbers 4231, 102306, 7277420000 are...原创 2019-08-13 16:57:43 · 172 阅读 · 0 评论 -
D - Party at Hali-Bula POJ - 3342 (树形dp模板)(判唯一)
Dear Contestant,I’m going to have a party at my villa at Hali-Bula to celebrate my retirement from BCM. I wish I could invite all my co-workers, but imagine how an employee can enjoy a party when he ...原创 2019-08-13 16:59:06 · 166 阅读 · 0 评论 -
POJ 3254 Corn Fields(状压dp)(模板)
Farmer John has purchased a lush new rectangular pasture composed of M by N (1 ≤ M ≤ 12; 1 ≤ N ≤ 12) square parcels. He wants to grow some yummy corn for the cows on a number of squares. Regrettably, ...原创 2019-08-13 17:51:02 · 314 阅读 · 0 评论 -
HDU 2196 Computer(树形dp)
A school bought the first computer some time ago(so this computer’s id is 1). During the recent years the school bought N-1 new computers. Each new computer was connected to one of settled earlier. Ma...原创 2019-08-13 21:54:35 · 222 阅读 · 4 评论 -
hdu3709 Balanced Number(数位dp)(暴力)(负数状态处理)
A balanced number is a non-negative integer that can be balanced if a pivot is placed at some digit. More specifically, imagine each digit as a box with weight indicated by the digit. When a pivot is ...原创 2019-08-14 13:25:26 · 138 阅读 · 4 评论 -
HDU - 2809 God of War (暴力状压dp)(模拟)
At 184~280 A.D ,there were many kingdoms in China. Three strongest among them are “Wei”, “Shu”, “Wu”. People call this period as “Three Kingdoms”.HH is a super “Three Kingdoms” fan, because at this p...原创 2019-08-14 19:29:24 · 309 阅读 · 0 评论 -
SPOJ - BALNUM Balanced Numbers(状压)(数位dp)
Balanced numbers have been used by mathematicians for centuries. A positive integer is considered a balanced number if: Every even digit appears an odd number of times in its decimal representation...原创 2019-08-15 13:07:17 · 157 阅读 · 1 评论 -
F - Mondriaan's Dream POJ - 2411(状压dp)(暴力)
Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his ‘toilet series’ (where he had to use his toilet paper to draw on, for all of h...原创 2019-08-16 20:52:56 · 161 阅读 · 0 评论 -
D - Y HDU - 4705(树形dp)(数学知识)(容斥)
Input41 21 31 4Output1HintThe only set is {2,3,4}.Please use #pragma comment(linker, “/STACK:16777216”)Sample Input41 21 31 4Sample Output1HintThe only set is {2,3,4}.Ple...原创 2019-08-17 16:05:04 · 209 阅读 · 0 评论 -
C - Monkey and Banana (HDU - 1069) (dp)(最长上升子序列+枚举)
A group of researchers are designing an experiment to test the IQ of a monkey. They will hang a banana at the roof of a building, and at the mean time, provide the monkey with some blocks. If the monk...原创 2019-07-10 18:08:15 · 222 阅读 · 0 评论 -
Max Sum Plus Plus HDU - 1024(dp)(滚动数组优化)
Now I think you have got an AC in Ignatius.L’s “Max Sum” problem. To be a brave ACMer, we always challenge ourselves to more difficult problems. Now you are faced with a more difficult problem.Given ...原创 2019-07-09 16:54:12 · 208 阅读 · 0 评论 -
问题 E: HD玩具(dp)
时间限制: 1 Sec 内存限制: 256 MB提交: 188 解决: 49[提交] [状态] [命题人:admin]题目描述商店正在出售小C最喜欢的系列玩具,在接下来的n周中,每周会出售其中的一款,同一款玩具不会重复出现。由于是小C最喜欢的系列,他希望尽可能多地购买这些玩具,但是同一款玩具小C只会购买一个。同时,小C的预算只有m元,因此他无法将每一款都纳入囊中。此外,小C不能连续两...原创 2019-07-08 14:59:11 · 264 阅读 · 0 评论 -
LightOj 1422 Halloween Costumes(区间dp)
#include<iostream>#include<string.h>using namespace std;int a[200];int dp[200][200];int main(){ int t;cin>>t; int cn=1; while(t--){ memset(dp,0,sizeof(dp)); int n;scanf(...原创 2019-05-02 01:15:34 · 153 阅读 · 0 评论 -
uva10003(区间dp)
#include<iostream>#include<string.h>#define inf 0x3f3f3f3fusing namespace std;int a[100];int r;int dp[1003][1003];int main(){ int sl; while(cin>>sl){ if(sl==0) break; int...原创 2019-05-02 23:21:08 · 181 阅读 · 0 评论 -
uva10003(区间dp)
#include<iostream>#include<string.h>#define inf 0x3f3f3f3fusing namespace std;int a[100];int r;int dp[1003][1003];int main(){ int sl; while(cin>>sl){ if(sl==0) break; int...原创 2019-05-02 23:21:19 · 151 阅读 · 0 评论 -
饭卡 HDU - 2546
一维数组01背包模板#include<iostream>#include<string.h>#include<algorithm>using namespace std;int a[1100];int m;int dp[1009];int main(){ int n; while(~scanf("%d",&n),n){ memset...原创 2019-05-03 22:24:49 · 271 阅读 · 0 评论 -
POJ 1276 Cash Machine(多重背包模板)
多重背包模板:#include<iostream>#include<stdio.h>#include<string.h>using namespace std;int dp[100009];int a[20];int num[1009];int main(){ int al; while(cin>>al){ int n;cin&...原创 2019-05-05 00:53:28 · 162 阅读 · 0 评论 -
I love sneakers!(多重背包)(分组)(每组只取一个)(模板)
分组,每组只取一个的背包#include<iostream>using namespace std;int s[109],v[109],w[109];int dp[102][10009];int max(int a,int b,int c){ int t=a>b?a:b; return t>c?t:c;}int main(){ int n,...原创 2019-05-05 02:42:00 · 222 阅读 · 0 评论 -
Palindrome subsequence HDU - 4632
#include<iostream>#include<string.h>using namespace std;const int mod=10007;int dp[1009][1009];int main(){ int t;int ca=0; while(~scanf("%d",&t)){ ca++; string ss;cin>&...原创 2019-04-29 17:09:23 · 149 阅读 · 0 评论 -
Palindrome subsequence HDU - 4632
#include<iostream>#include<string.h>using namespace std;const int mod=10007;int dp[1009][1009];int main(){ int t;int ca=0; while(~scanf("%d",&t)){ ca++; string ss;cin>&...原创 2019-04-29 17:09:33 · 147 阅读 · 0 评论 -
UVA 624 CD(01背包)(记录路径)
#include<iostream>#include<string.h>using namespace std;int a[10009];int dp[10009];int vis[25][10009];int main(){ int n;int N; while(~scanf("%d",&N)){ memset(dp,0,sizeof(dp));...原创 2019-05-06 20:13:34 · 153 阅读 · 0 评论 -
poj2392 Space Elevator(多重背包转化为完全背包与01背包)
#include<iostream>#include<algorithm>#include<stdio.h>using namespace std;struct node{ int a,b,c;}a[430];int dp[40500];bool cmp(node a,node b){ return a.b<b.b;}int m...原创 2019-05-10 01:16:49 · 279 阅读 · 0 评论 -
Brackets(区间dp)
#include<iostream>#include<string.h>using namespace std;int dp[109][109];int main(){ string a; while(cin>>a){ if(a=="end") break; int n=a.size(); memset(dp,0,sizeof(dp))...原创 2019-05-07 21:46:29 · 211 阅读 · 0 评论 -
2018 宁夏邀请赛 Moving On Gym - 102222F(深入理解三维floyd)
Firdaws and Fatinah are living in a country with n cities, numbered from 1 to n. Each city has a risk of kidnapping or robbery.Firdaws’s home locates in the city u, and Fatinah’s home locates in th...原创 2019-09-01 21:01:01 · 248 阅读 · 0 评论
分享