上一页 1 2 3 4 5 6 ··· 26 下一页
摘要: 约瑟夫题目变形,思路和前面白书那个例题差不多~~#include#include#include#include#define maxn 500009using namespace std;int dp1[maxn];int dp2[maxn];int dp3[maxn];int main(){ ... 阅读全文
posted @ 2014-07-16 14:16 Yours1103 阅读(112) 评论(0) 推荐(0) 编辑
摘要: 比较不错的一个题,关键是理解状态转移#include#include#include#include#define maxn 55using namespace std;int m,ans;int num[maxn],vis[maxn];bool cnt[1000009];int scale[10]... 阅读全文
posted @ 2014-07-16 11:53 Yours1103 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 稍微有点新意的二分#include#include#include#include#include#include#include#define eps 0.000001#define maxn 5005using namespace std;int n;double w;struct node{ ... 阅读全文
posted @ 2014-07-15 23:11 Yours1103 阅读(138) 评论(0) 推荐(0) 编辑
摘要: 状态压缩dp#include#include#include#include#include#define maxn 16using namespace std;long long dp[1<<maxn];long long weapon[1<<maxn];int robot[maxn];char ... 阅读全文
posted @ 2014-07-15 17:00 Yours1103 阅读(127) 评论(0) 推荐(0) 编辑
摘要: dp[i][j]意思是前i个分成j组最小的花费#include#include#include#include#include#define maxn 110using namespace std;int dp[maxn][maxn];int vis[maxn][maxn];int num[maxn... 阅读全文
posted @ 2014-07-15 15:13 Yours1103 阅读(111) 评论(0) 推荐(0) 编辑
摘要: View Code 阅读全文
posted @ 2014-07-15 13:59 Yours1103 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 #include 4 #define maxn 5100 5 #include 6 using namespace std; 7 8 struct node 9 { 10 int x,y; 11 int id; 1... 阅读全文
posted @ 2014-06-23 21:17 Yours1103 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 状态压缩dp#include#include#include#define maxn 4100using namespace std;int map[13][13];int dp[maxn][510];int gcd(int x,int y){ return y==0?x:gcd(y,x%y)... 阅读全文
posted @ 2014-04-22 16:59 Yours1103 阅读(204) 评论(0) 推荐(0) 编辑
摘要: 有依赖的背包,转化成01背包来做;#include#include#include#includeusing namespace std;int n,m;int f[100009];int dp[100009];int main(){ int num,value,pen,pp; while(scanf("%d%d",&n,&m)!=EOF) { memset(f,0,sizeof f); for(int i=1; i=pen; j--) { dp[j]=max(dp[j],dp[j... 阅读全文
posted @ 2014-04-08 15:37 Yours1103 阅读(124) 评论(0) 推荐(0) 编辑
摘要: 有依赖的背包,用树形dp解#include#include#include#include#define maxn 205using namespace std;int n,m;int f[maxn][maxn];struct node{ int pre; int cnt_son; int son[maxn]; int value;} no[maxn];void dfs(int x){ f[x][1]=no[x].value; int v; for(int i=0; i1; j--)//从大往小更新,结果不会覆盖; { ... 阅读全文
posted @ 2014-04-08 14:13 Yours1103 阅读(109) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 ··· 26 下一页