Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

하노이탑/이재혁김상섭: Difference between revisions

From ZeroWiki
imported>Unknown
No edit summary
 
(Repair batch-0008 pages from live compare)
 
Line 27: Line 27:
  }
  }
----
----
[[김상섭]]
김상섭
[[하노이탑]]
[[하노이탑]]

Latest revision as of 01:40, 27 March 2026

#include <iostream>

using namespace std;

int num(int val, int start, int end);

int main()
{
	cout << num(3, 1, 2) << endl;

	return 0;
}

int num(int val, int start, int end)
{
	
	if(val == 1)
	{
		cout << start << "->" << end << endl;

		return 1;
	}
	else
	{
		return num(val - 1, start, 6-start-end) + num(1,start,end) + num(val - 1, 6-start-end, end);
	}
}

김상섭 하노이탑