Created
January 8, 2012 20:37
-
-
Save catupper/1579598 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from __future__ import division | |
| from random import randint | |
| def dices(a): | |
| t=randint(1,6) | |
| j=1 | |
| res=1 | |
| while(a!=j): | |
| p=randint(1,6) | |
| if(p==t): | |
| j+=1 | |
| else: | |
| j=1 | |
| res+=1 | |
| t=p | |
| return res | |
| def kakuritu(x): | |
| res=dices(x) | |
| for a in range(1,10000): | |
| res=((res*a)+dices(x))/(a+1) | |
| print res | |
| kakuritu(2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment