++

Ready for the next challenge?

"5 Guys and a Bunch of Coconuts"

Here is a link to the text description of the problem.

git.qoto.org/Absinthe/coconuts

That link is to the repo, and my solution is in it as well.

Follow

@Absinthe
def coctake (n,m):
for i in range (m):
n = n*1.2
n = n+1
return n
def hcoctake (n,m):
for i in range (m):
n = n*0.2
n = n+1
return n
for i in range(1000) :
j = coctake(i*5,5)
j = float(j)
if (j).is_integer() is True :
print int(j)
for m in range (5):
print int(i+hcoctake(i*5,m))
else :
continue
My approach return the original number of coconut to 7771, which is a bit absurd so I don't know if this approach is correct or not. What it does is that it tries to guess the number of the morning pile divided by 5. It then reverse engineer that number to find the possible number of coconut at the start. If the number of coconut that if found is a whole number, it will print that number and find the number of coconut the other 5 people get.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.