PTA的Python练习题(补)

题目要求我们实现进制的转换,当时做题只写出来一个实现两位数的

import math
a,b=map(int,input().split(','))
c=len(str(a))
d=e=f=0
g=a
for i in range(c):
        g-=f
        d=round(g/10**(c-i-1))
        f=d*(10**(c-i-1))
        e+=d*(b**(c-i-1))
print(e)
[Sign]做不出ctf题的时候很痛苦,你只能眼睁睁看着其他人领先你
原文地址:https://www.cnblogs.com/echoDetected/p/12889317.html