c*****y 发帖数: 90 | 1 【 以下文字转载自 JobHunting 讨论区 】
发信人: cctvboy (盼好运), 信区: JobHunting
标 题: 问一个算法题
发信站: BBS 未名空间站 (Tue Oct 21 18:21:13 2008)
有关combination的。有三个paramter A、B、和C如下:
Parameter name Start value End value Step size
A 60 90 10
B 0.0 1.0 0.2
C 1 3 1
The 72 combinations arise from 4 different values for A, times 6 for B, and
times 3 for C. Thus, the combinations tr | j********x 发帖数: 2330 | 2 用循环来模拟递归
int level = 0;
int* recurIndex = new int[numberOfParameter];
for(inti = 0; i < numberOfParameter; ++i) {
recurIndex[i] = (end - start) / stepSize + 1;
}
while(1) {
相当于有一个n位的证书,每一位的进制由其对应的变量的取值个数决定。然后从最
低位开始减少/增加,直到最高位到极限
}
| c*****y 发帖数: 90 | 3 提供一个我的程序,没有用递归。
static void Main(string[] args)
{
//Open and read the file in which the parameter values are saved
//and save the content in this file to string S
//ATTENTION: In this example, we require that there is blank
space after each value
StreamReader SR;
string S;
SR = File.OpenText("c:\\TASK.txt");
S = SR.ReadToEnd();
StringBuilder readch = new StringBuilder();
int len = |
|