2015年8月5日

POJ百练—IP地址转换

摘要: #include#include#includeusing namespace std;int sign[9];void change_to_8(int x){ int index=8; while(x) { if(x&1) { s... 阅读全文

posted @ 2015-08-05 22:11 vCoders 阅读(251) 评论(0) 推荐(0)

HDOJ1213(并查集)

摘要: set容器中的值互异,非常好用。水题,直接贴代码了#include#include#includeusing namespace std;set ans;const int SIZE=1000+16;int par[SIZE];int rnk[SIZE];void init(int n){ f... 阅读全文

posted @ 2015-08-05 20:46 vCoders 阅读(200) 评论(0) 推荐(0)

HDOJ1059(多重背包)

摘要: 1.解法一:多重背包#include#includeusing namespace std;#define MAX(a,b) (a>b)?a:bconst int SIZE=500000+16;int dp[SIZE];int bag[7];int nLimit;void ZeroOnePack(i... 阅读全文

posted @ 2015-08-05 17:42 vCoders 阅读(213) 评论(0) 推荐(0)

HDOJ1171(多重背包)

摘要: #include#includeusing namespace std;#define MAX(a,b) (a>b)?a:bconst int SIZE=100000+16;int nKind; //物品种类数目int nLimit; //背包容量int val[SIZE]; //每种背包的价值in... 阅读全文

posted @ 2015-08-05 16:24 vCoders 阅读(195) 评论(0) 推荐(0)

多重背包(标准模板)

摘要: #include#includeusing namespace std;#define MAX(a,b) (a>b)?a:bconst int SIZE=1000+16;int nKind; //物品种类数目int nLimit; //背包容量int val[SIZE]; //每种背包的价值int ... 阅读全文

posted @ 2015-08-05 15:30 vCoders 阅读(443) 评论(0) 推荐(0)

2015年8月4日

HDOJ1251(前缀匹配---分块查找&map应用)

摘要: 分块查找算法#include#include#include#includeusing namespace std;const int SIZE=1300000+16;const int BLOCKS=50000; //块的大小char word[SIZE][11];char pre[20];int... 阅读全文

posted @ 2015-08-04 17:00 vCoders 阅读(224) 评论(0) 推荐(0)

2015年8月3日

hdoj1113(字符串map应用)

摘要: #include#include#include#include#include#includeusing namespace std;#define END "XXXXXX"const int SIZE=10000+16;map dic;void Fun_in(){ string s; ... 阅读全文

posted @ 2015-08-03 23:54 vCoders 阅读(131) 评论(0) 推荐(0)

HDOJ1075字典翻译(map应用)

摘要: #include#include#include#include#includeusing namespace std;const int SIZE=10000+16;char book[SIZE];map dic;void fun_in(){ char start[6]={'\0'}; ... 阅读全文

posted @ 2015-08-03 22:18 vCoders 阅读(115) 评论(0) 推荐(0)

HDOJ1114(完全背包)

摘要: #include#include#includeusing namespace std;const int INF=0x30303030;const int SIZE=10000+16;int w[SIZE];int v[SIZE];int dp[SIZE];int main(){ int T... 阅读全文

posted @ 2015-08-03 17:37 vCoders 阅读(136) 评论(0) 推荐(0)

浅谈背包

摘要: 1.01背包for(int i=0; i=w[i]; j--) //从后向前更新 { if(dp[j]=W; j++) //从前向后更新 { if(dp[j]#include#include#includeusing namespace std;const int S... 阅读全文

posted @ 2015-08-03 17:36 vCoders 阅读(172) 评论(0) 推荐(0)

导航

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