unit DateUtils;interfaceuses SysUtils, Math, Types;// 把完整时间分解成日期和时间两部分function DateOf(const AValue: TDateTime): TDateTime;function TimeOf(const AValu... Read More
posted @ 2012-02-10 05:22 findumars Views(28109) Comments(0) Diggs(0) Edit
// 16x3.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include<iostream.h>template<class T>class Loading { friend GetMaxLoading(T [], T, int, int []); private: void Compute(int i); int n, *x, // 当前取值 *bestx; // 目前的最佳方案 ... Read More
posted @ 2012-02-10 03:46 findumars Views(854) Comments(0) Diggs(0) Edit
// 16x2.cpp : Defines the entry point for the console application.//#include "stdafx.h"// 优化了回溯代码// 即不移动到不可能包含比当前最优解还要好的解的右子树#include<iostream.h>template<class T>class Loading { friend GetMaxLoading(T [], T, int); private: void Compute(int i); int n; // 货箱数量 T *w, // 货箱重量数组... Read More
posted @ 2012-02-10 03:43 findumars Views(1762) Comments(0) Diggs(0) Edit
// 16x1.cpp : Defines the entry point for the console application.//#include "stdafx.h"// 回溯法,解空间分为排列数和子集树,前者是不同节点顺序的排列,后者是一个(0,1,...)的向量子集// 最大装载问题,是一个NP问题,目前只计算第一艘船,属于子集树// 有几个货物,子集树就有几层,当前题目为5层// 我感觉递归还是太过于精巧和经凑,很难挖空心思自己写出来,多熟悉别人现有的程序是一个好办法。#include<iostream.h>template<class T& Read More
posted @ 2012-02-10 03:40 findumars Views(3757) Comments(0) Diggs(0) Edit