背包思想
来源:互联网 发布:图片在数据库中的类型 编辑:程序博客网 时间:2024/04/27 15:16
package ss;
public class aa {
/**
* @param args
*/
static int lenth = 5;
static int T = 10;
static int w[]= {2,4,6,8,10};
static int already = 0;
static int a[]= {0,0,0,0,0};
public static void go(int i)
{
if(already == T)
{
for(int j = 0;j< lenth;j++)
{
System.out.print(a[j]+" ");
}
System.out.println();
}
else
{
for(int m = i;m < lenth;m++)
{
if(a[m] == 0 && already + w[m] <= T)
{
a[m] = 1;
already += w[m];
go(m+1);
a[m] = 0;
already -= w[m];
}
}
}
}
public static void main(String[] args)
{
// TODO Auto-generated method stub
go(0);
}
}
- 背包思想
- 背包问题基本思想
- 背包思想衍生算法
- 背包问题的解题思想
- HDU2191 多重背包(二进制思想)
- nyoj927(01背包的思想)
- 多重背包二进制分解思想
- hdu 5890 bitset+背包思想
- 01背包(转换思想)(背包容量超大~)
- 多重背包的二进制分解思想
- 多重背包问题的二进制分解思想
- 多重背包的二进制分解思想
- POJ1276多重背包二进制思想优化
- 多重背包二进制分解思想讲解
- 多重背包的二进制分解思想
- UVA10817 状压DP+01背包思想
- 01背包通俗易懂的讲解(思想)
- 背包问题思想的一个应用
- JQuery--Ajax--get方法
- MFC TOOLTIP的使用
- 程序员必须知道的几个国外IT网站
- 脚本学习 函数接口说明
- Js_事件
- 背包思想
- 穿过已知点画平滑曲线(3次贝塞尔曲线)
- Oracle 优化器:CBO 和 RBO
- Android ListView example
- fedora 16的KVM安装步骤(速成)
- 如何是InterNet安全級別可以修改
- 程序员常用工具
- 基于s3c2410的uboot1.2.0的分析以及移植
- 你最喜欢的编程字体?