Created
January 10, 2018 12:54
-
-
Save hareeen/1fc8edbb8afb8d24eb7bd6c98bcaa564 to your computer and use it in GitHub Desktop.
FuchsiaDimgreyHound created by anonymous - https://repl.it/repls/FuchsiaDimgreyHound
This file contains 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
import math | |
a=dict() | |
b=dict() | |
def hello(n,k): | |
st=[] | |
for i in range(1,min([2*k+1,n+1])): | |
st.append((n-i, i)) | |
return st | |
def johncena(n,k): | |
if n<=2*k: | |
a[(n,k)]=True | |
b[(n,k)]=n | |
return | |
st1=hello(n,k) | |
st2=[] | |
for i in st1: | |
fl=False | |
if a[(i[0],i[1])]: | |
continue | |
st2=hello(i[0], i[1]) | |
for j in st2: | |
if j[0]<=j[1]*2 or a[j]: | |
pass | |
else: | |
fl=True | |
break | |
if not fl: | |
a[(n,k)]=True | |
b[(n,k)]=i[1] | |
return | |
a[(n,k)]=False | |
return | |
r=300 | |
for i in range(0,300): | |
for j in range(1,300): | |
johncena(i,j) | |
while True: | |
i, j=[int(k) for k in input().split()] | |
if i==0 and j==0: | |
break | |
print(i, j, a[(i,j)]) | |
if a[(i,j)]: | |
print(b[(i,j)]) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment