-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsnail.py
More file actions
38 lines (33 loc) · 1.14 KB
/
snail.py
File metadata and controls
38 lines (33 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
class SnailProblem(object):
"""
snail climbs out of a well. he climbs up 2m/day if it's rainy
or 1m/day if it's clear.
Using discrete distribution library
"""
def __init__(self, n, m):
self.n = n #the well is n meter deep
self.m = m #the rainy season lasts for m days
self.r = n-m
assert(int==type(n) and int==type(m) and r>=0)
self.p = 0.75
def getProb(self):
testcase = int(input())
assert(int == type(testcase) and testcase <= 50 and 1 >= testcase)
for i in range(testcase):
(n,m) = tuple(input.split())
snailProblem = SnailProblem(n,m)
print(snailProblem.getProb)
#==============================================================================
#
# import scipy.stats as ss
#
# n = 15 # Number of total bets
# p = 18./38 # Probability of getting "red" at the roulette
# max_sbets = 4 # Maximum number of successful bets
#
# hh = ss.binom(n, p)
#
# total_p = 0
# for k in range(1, max_sbets + 1): # DO NOT FORGET THAT THE LAST INDEX IS NOT USED
# total_p += hh.pmf(k)
#==============================================================================