Created
July 19, 2016 12:57
-
-
Save asuka-mirai/df0b7e656ea538c76310b46167423606 to your computer and use it in GitHub Desktop.
Base_Exchange_Palindrome
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
num = 10 | |
judge = False | |
try: | |
while True: | |
base = input().split(',') | |
except EOFError: | |
pass | |
base_01 = int(base[0]) | |
base_02 = int(base[1]) | |
def radix_convert(number, radix): | |
s = [] | |
while number>0: | |
s.append(number%radix) | |
number = number//radix | |
return s[::-1] | |
while judge == False: | |
num_base01 = radix_convert(num, base_01) | |
num_base02 = radix_convert(num, base_02) | |
if num_base01 != num_base01[::-1] or num_base02 != num_base02[::-1]: | |
judge = False | |
num += 1 | |
else: | |
judge = True | |
print(num) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment