Hello everybody,
I am pretty new to this google group. In general I have recently got to
know about Kick Start and Code Jam competition. So excuse my lack of
familiarty and possibly studpid questions. I have attended to the Kick
Start Round B. I found the problems interesting and fun to solve. The last
problem "Wandering Robot" which I found the most interesting puzzles me up
until today. I keep getting WA feeadback from the judge system. My code is
written in Python 3. In case any of you have some spare time and interested
maybe you can help me figure out what I am doing wrong.
import numpy as np
def main():
t = int(input())
for i in range(t):
print('Case #{0}: {1}'.format(i + 1, round(get_answer(),10)))
def calcPr(X,Y):
n=X+Y-2
x=X-1
N=0
for k in range(1,n+1):
N+=np.log2(k,dtype="float64")
X=0
for k in range(1,x+1):
X+=np.log2(k,dtype="float64")
NX=0
for k in range(1,n-x+1):
NX+=np.log2(k,dtype="float64")
foo=N-X-NX-n
output=2**foo
return output
def get_answer():
W, H, C1, R1, C2, R2=list(map(int, input().split()))
if R2==H and C2==W:
return 0.0
if R1==1 and C1==1:
return 0.0
if R2-R1+1==H:
return 0.0
if C2-C1+1==W:
return 0.0
# up right corner
X=C2+1
Y=R1-1
mypr=0
while X<=W and Y>=1:
mypr+=calcPr(X,Y)
X+=1
Y-=1
# bottom left corner
X=C1-1
Y=R2+1
while X>=1 and Y<=H:
mypr+=calcPr(X,Y)
X-=1
Y+=1
return mypr
main()
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/deb63407-62ef-45b2-a586-caa035fbff0b%40googlegroups.com.