Skip to content

Instantly share code, notes, and snippets.

@yogeesh
Created August 21, 2014 17:24
Show Gist options
  • Save yogeesh/68d6f4ebb74f3a3a3835 to your computer and use it in GitHub Desktop.
Save yogeesh/68d6f4ebb74f3a3a3835 to your computer and use it in GitHub Desktop.
'''
100 chicken and $100
$0.05, $1, 5$
'''
#Setting Total
tcost=100
tnum=100
#Setting individual max
x=99
y=99
z=99
#Lets Brute Force :D
flag=0
for i in range(1,x+1):
if flag:
break
for j in range(1, y+1):
z=tnum-i-j
if z:
print "Trying x=%s y=%s z=%s"%(i, j, z)
if (z*5 + j + i*0.05) == tcost:
print "Ungaya HIT x=%s y=%s z=%s"%(i, j, z)
flag=flag+1
break
print "```````````````END``````````````"
print "Possible Solutions = %s"%flag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment