上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 30 下一页
摘要: 1 //简单的背包应用,奈何我摔了好几次 2 #include 3 #include 4 #define maxn 120000 5 int n[6]; 6 int a[maxn]; 7 int Room; 8 void zero_one_bag(int); 9 void complete_bag(int); 10 void multiple_bag(int,int); 11 ... 阅读全文
posted @ 2017-02-17 22:01 Posase 阅读(175) 评论(0) 推荐(0) 编辑
摘要: 1 //找到数如何算即可 2 #include 3 int a[6000]={1}; 4 5 void Humble_Numbers(); 6 int minf(int,int,int,int); 7 8 int main() 9 { 10 Humble_Numbers(); 11 int n; 12 while(~scanf("%d",&n) &&... 阅读全文
posted @ 2017-02-17 19:59 Posase 阅读(260) 评论(0) 推荐(0) 编辑
摘要: 详见大牛背包九讲(下载地址:http://pan.baidu.com/s/1b9edXW) 阅读全文
posted @ 2017-02-17 13:42 Posase 阅读(310) 评论(0) 推荐(0) 编辑
摘要: 1 //我的dfs入门。将1~n一次填入数组然后打印。 2 #include 3 #include 4 int v[101]; 5 int a[101]; 6 void dfs(int,int); 7 8 int main() 9 { 10 int n; 11 while(~scanf("%d",&n)) 12 { 13 memset(... 阅读全文
posted @ 2017-02-17 12:54 Posase 阅读(315) 评论(0) 推荐(0) 编辑
摘要: 1 //用c++的sort可以过 2 #include 3 int main() 4 { 5 int n; 6 while(~scanf("%d",&n)) 7 { 8 int ans,ant,num=0; 9 while(n--) 10 { 11 scanf("%d",&ant);... 阅读全文
posted @ 2017-02-16 20:37 Posase 阅读(256) 评论(0) 推荐(0) 编辑
摘要: 1 //只需要一个数组存可用系统最高拦截高度 2 #include 3 int s[6000]; 4 int main() 5 { 6 int n; 7 while(~scanf("%d",&n)) 8 { 9 int ans=1,top=-1,x,i,j; 10 for(i=0; i= x) 20 ... 阅读全文
posted @ 2017-02-16 19:58 Posase 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 1 //大牛的多重背包二进制优化写法 2 #include 3 #include 4 int r[105],v[105],n[105]; 5 int a[1005]; 6 int Room; 7 8 void db(int,int,int); 9 void lb(int,int); 10 void wb(int,int); 11 12 int main() 13 { 14 ... 阅读全文
posted @ 2017-02-16 19:03 Posase 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 1 //完全背包,有待改良 2 #include 3 #include 4 typedef struct 5 { 6 int val,room; 7 } cus; 8 int an[10005]; 9 cus inf[505]; 10 int main() 11 { 12 int n; 13 scanf("%d",&n); 14 while(n-... 阅读全文
posted @ 2017-02-16 11:50 Posase 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 1 //01背包,详见背包九讲 2 #include 3 #include 4 typedef struct 5 { 6 int val,room; 7 } cus; 8 int an[1005]; 9 cus inf[1005]; 10 int main() 11 { 12 int n; 13 scanf("%d",&n); 14 while(... 阅读全文
posted @ 2017-02-15 18:18 Posase 阅读(198) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #define maxn 1000000 3 int cs[2][maxn]; 4 int know=0,angry=0; 5 int main() 6 { 7 for(int i=125; i<maxn; ++i) 8 { 9 10 if(i%1000==521 || i/10%1000==521 |... 阅读全文
posted @ 2017-02-14 17:59 Posase 阅读(137) 评论(0) 推荐(0) 编辑
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 30 下一页