#
# coding:utf-8
#
# __author__ = 'JyHu'
# 

def fact(n):
	if n == 1:
		return 1
	return n * fact(n - 1)

print(fact(1))
print(fact(5))
print(fact(10))


print('\n-----------------------------\n')
print('\n-----------------------------\n')
print('\n-----------------------------\n')


def factn(n):
	return fact_iter(n, 1)
def fact_iter(num, product):
	if num == 1:
		return product
	return fact_iter(num - 1, num * product)
print(factn(6))
print('\n-----------------------------\n')
print(factn(20))


# 汉诺塔

def move(n, a, b, c):
	if n == 1:
		print('move ' + a + ' ----> ' + c)
		return
	move(n-1, a, c, b)
	print('move ' + a + ' ----> ' + c)
	move(n-1, b, a, c)

move(10, 'A', 'B', 'C')

