上一页 1 ··· 12 13 14 15 16
摘要: 1.试设计一个用回溯法搜索子集空间树的函数。该函数的参数包括结点可行性判定函数和上界函数等必要的函数,并将此函数用于解0-1背包问题。 0-1 背包问题描述如下:给定n 种物品和一个背包。物品i 的重量是wi ,其价值为vi ,背包的容量为C。应如何选择装入背包的物品... 阅读全文
posted @ 2018-03-27 17:33 ~~zcy 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 约瑟夫环Input 7 5(有几组数据)10 4 11 4 1(从一开始去除谁)Output 4 2 5 6 1 Input 3 22 5Output 3 2 #include #include #include using namespace std;#inclu... 阅读全文
posted @ 2018-03-27 15:44 ~~zcy 阅读(59) 评论(0) 推荐(0) 编辑
摘要: 打印杨辉三角前n行Sample Input6Sample Output11 11 2 11 3 3 11 4 6 4 11 5 10 10 5 1 #include int main(){ int i,j,s=0,k,n,e; while(scanf("%... 阅读全文
posted @ 2018-03-27 15:20 ~~zcy 阅读(160) 评论(0) 推荐(0) 编辑
上一页 1 ··· 12 13 14 15 16