chidor @ 2022-07-15 10:06:48
def radixes(number,num_radix,out_radix):
raxid=0
raxid10= int(number, num_radix)
if(out_radix == 2):
raxid = bin(raxid10)
elif(out_radix == 8):
raxid = oct(raxid10)
elif(out_radix == 16):
raxid = hex(raxid10)
elif(out_radix == 10):
raxid = raxid10
return raxid
return raxid[2:]
def h(number):
if(str(number) == str(number)[::-1]):
return True
else:
return False
n = int(input())
m = input()
s = radixes(m,n,10)
for i in range(30):
if h(s):
print('STEP=' + str(i))
exit()
s += int(str(s)[::-1])
print('Impossible!')
by Dreamer_002 @ 2022-07-25 15:38:35
人家又没有说只有2,8,10,16这几个进制咯,
改成高精度即可,只是/10和%10变成了/n,%n。