Non-recipientless non-stack algorithm for Hanno Tag (2)

zhaozj2021-02-16  52

For the former method / * principle: If the three columns are enclosed in a ring, the total number of trays is n, and the law of its movement is: if n is an even number: 2 steps per time; even 1 step per time If n is an odd number: an odd number disk each time 1 step; the even number disk is 2 steps each time; as for the next one of which pillars on the move, it can be judged by size and order. The above can pass mathematical proof, not described above! * /

The following is the second algorithm:

#include #include void main () {int tt = 1, ff = 1, fff = 1, t; cout << "Please enter (1-64):"; CIN> > T; cout << "f: means the start of the plate" << endl; cout << "T: indicates the target of the tray" << Endl; cout << "o: Indicates that there is no use in this step "<< Endl << Endl; for (int I1 = 1; I1 <= T; I1 , ff * = 2); char ** hand; hand = new char * [FF 1]; for (int I2 = 0; i2

转载请注明原文地址:https://www.9cbs.com/read-21956.html

New Post(0)