Skip to content

Instantly share code, notes, and snippets.

@KatUser
Created July 23, 2020 08:01
Show Gist options
  • Save KatUser/764ca933487fb671195def756fe7d422 to your computer and use it in GitHub Desktop.
Save KatUser/764ca933487fb671195def756fe7d422 to your computer and use it in GitHub Desktop.
88 = 32 +22 +17 +16 in 9 sys
trees = int(input())
apples, pears, plums, cherries = int(input()), int(input()), int(input()), int(input())
sys = 1
def findsys(s):
while True:
if (trees//10) * (s**1) + (trees%10) * (s**0) == (apples//10) * (s**1) + (apples%10) * (s**0) + (pears // 10) * (s ** 1) + (pears % 10) * (s ** 0) + (plums//10) * (s**1) + (plums%10) * (s**0) + (cherries//10) * (s**1) + (cherries%10) * (s**0):
print(s)
break
else:
s = s + 1
findsys(sys)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment