- 注册时间
- 2011-4-2
- 最后登录
- 1970-1-1
- 威望
- 星
- 金币
- 枚
- 贡献
- 分
- 经验
- 点
- 鲜花
- 朵
- 魅力
- 点
- 上传
- 次
- 下载
- 次
- 积分
- 2109
- 在线时间
- 小时
|
发表于 2013-1-16 15:02:57
|
显示全部楼层
5# Lwins_G
精彩而优美!
# -*- coding: utf-8 -*-
"""
Hook-length Formula
"""
# MainFunction : Calculate the Number of Young Matrix using Hook-length Formula
def Hook(n,m):
HookProd=1
for i in range(1,n+1):
for j in range(1,m+1):
HookProd=HookProd*((n+m)-(i+j)+1)
return Fact(n*m)/HookProd
# SubFunction : Calculate the Factorial of Integer Number n
def Fact(n):
if n==0:
return 1
else:
return n*Fact(n-1)
# Test
row=int(raw_input('Input Row Number n = '))
for col in range(1,20):
print 'When Col Number = ',col,', the result is = ',Hook(row,col)
Input Row Number n = 2
When Col Number = 1 , the result is = 1
When Col Number = 2 , the result is = 2
When Col Number = 3 , the result is = 5
When Col Number = 4 , the result is = 14
When Col Number = 5 , the result is = 42
When Col Number = 6 , the result is = 132
When Col Number = 7 , the result is = 429
When Col Number = 8 , the result is = 1430
When Col Number = 9 , the result is = 4862
When Col Number = 10 , the result is = 16796
When Col Number = 11 , the result is = 58786
When Col Number = 12 , the result is = 208012
When Col Number = 13 , the result is = 742900
When Col Number = 14 , the result is = 2674440
When Col Number = 15 , the result is = 9694845
When Col Number = 16 , the result is = 35357670
When Col Number = 17 , the result is = 129644790
When Col Number = 18 , the result is = 477638700
When Col Number = 19 , the result is = 1767263190 |
|