Skip to content

Instantly share code, notes, and snippets.

@FGFW
Created March 29, 2016 16:38
Show Gist options
  • Select an option

  • Save FGFW/62ec0845cbc8c2077ba1868d496d4e69 to your computer and use it in GitHub Desktop.

Select an option

Save FGFW/62ec0845cbc8c2077ba1868d496d4e69 to your computer and use it in GitHub Desktop.
python解无忧公主的数学时间097.py
"""
python解无忧公主的数学时间097.py
codegay 2016年3月30日 00:17:26
http://mp.weixin.qq.com/s?__biz=MzI5ODEwMDQyNw==&mid=402225879&idx=1&sn=6ea8e1d5e6a2520ad65eb2713a98af6e&3rd=MzA3MDU4NTYzMw==&scene=6#rd
"""
from itertools import product
n=[[h for h in range(1,7+1)] for r in range(5)]
f=lambda x:x[1]>x[0] and x[1]>x[2] and x[3]>x[2] and x[3]>x[4] and len(set(x))==5
x={r for r in product(*n) if f(r)}
print("097结果:",len(x))
#336
#[Finished in 0.1s]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment