文件名称:DivideAndConquer_Algo
介绍说明--下载内容均来自于网络,请自行研究使用
1. 依照介面提示輸入yes 或 no
2. 每局結束後會印出你心中猜想的兩個數字並計算當次花費的回合數
3. 每局之間可連續
本程式採用的演算法策略為divide-and-conquer algorithm
1. 先將範圍盡量縮小,優先程序為先從小範圍求出一解
2. 盡量以2的次方數取範圍做分割尋找一個數字時,平均最佳的方法必是二分法。
因此如何以最小步數找到第一個解?若搜尋範我採用的方法,就是以最小步數先尋找到一個解,接著再用二分法找出剩餘的一個解。為了讓二分法能夠廣泛使用,我將所有問題的範圍基本上都是以4作為起始的小單位,也是第一個問題選擇5和16的原因。
圍後的回答是yes,那我將會不停的搜尋此範圍直到確定一個答案為止。因為若跳脫再去搜尋未知的區域,可能得到的答案會是no,最後可能會繞一圈又回來同樣的範圍。-1. In accordance with interface prompted yes or no
2. After the end of each set will be printed in your heart Guess two numbers and calculate the number of turns when the time spent
3. Continuous between each set
The program uses the algorithm strategy divide-and-conquer algorithm
1. First minimizing the area, the priority program for the first of a solution obtained from small areas
2. As far as possible in order to obtain a power of 2 range to split the number to find a number, the average will be the best way is dichotomy.
So what is the minimum number of steps to find the first solution? If the search scope My approach is to first find the minimum number of steps to a solution, then using the left to find a solution dichotomy. Dichotomy can be widely used to make, and I will all the problems are basically the scope of 4 as the starting small unit, is the first question the reasons for selection 5 and 16.
Around after the answer is yes, then I will keep the scope of the
2. 每局結束後會印出你心中猜想的兩個數字並計算當次花費的回合數
3. 每局之間可連續
本程式採用的演算法策略為divide-and-conquer algorithm
1. 先將範圍盡量縮小,優先程序為先從小範圍求出一解
2. 盡量以2的次方數取範圍做分割尋找一個數字時,平均最佳的方法必是二分法。
因此如何以最小步數找到第一個解?若搜尋範我採用的方法,就是以最小步數先尋找到一個解,接著再用二分法找出剩餘的一個解。為了讓二分法能夠廣泛使用,我將所有問題的範圍基本上都是以4作為起始的小單位,也是第一個問題選擇5和16的原因。
圍後的回答是yes,那我將會不停的搜尋此範圍直到確定一個答案為止。因為若跳脫再去搜尋未知的區域,可能得到的答案會是no,最後可能會繞一圈又回來同樣的範圍。-1. In accordance with interface prompted yes or no
2. After the end of each set will be printed in your heart Guess two numbers and calculate the number of turns when the time spent
3. Continuous between each set
The program uses the algorithm strategy divide-and-conquer algorithm
1. First minimizing the area, the priority program for the first of a solution obtained from small areas
2. As far as possible in order to obtain a power of 2 range to split the number to find a number, the average will be the best way is dichotomy.
So what is the minimum number of steps to find the first solution? If the search scope My approach is to first find the minimum number of steps to a solution, then using the left to find a solution dichotomy. Dichotomy can be widely used to make, and I will all the problems are basically the scope of 4 as the starting small unit, is the first question the reasons for selection 5 and 16.
Around after the answer is yes, then I will keep the scope of the
(系统自动生成,下载前可以参看下载内容)
下载文件列表
DivideAndConquer_Algo.cpp