[ create a new paste ] login | about

Link: http://codepad.org/IC4pp2vH    [ raw code | fork ]

Python, pasted on Feb 19:
import math

def pick(x,y,z):
	a=y
	b=z
	if x==1:
		if a==1:
			print([a,b])
			return(1)
		else:
			if (int(a)%2==0):
				b+=int(a/2)
				a=int(a/2)
				print([a,b])
				pick(1,a,b)
			else:
				b+=int(math.ceil(a/2))
				a=int(math.floor(a/2))
				print([a,b])
				pick(2,a,b)
	else:
		if b==1:
			print([a,b])
			return(1)
		else:
			if (int(b)%2==0):
				a+=int(b/2)
				b=int(b/2)
				print([a,b])
				pick(2,a,b)
			else:
				a+=int(math.ceil(b/2))
				b=int(math.floor(b/2))
				print([a,b])
				pick(1,a,b)

pick(1,(insert),(insert))


Create a new paste based on this one


Comments: