PTA Tree Traversals

链接

https://pintia.cn/problem-sets/994805342720868352/problems/994805487143337984

题解

不得不我深深的为 P y t h o n Python 的短小精悍所折服
这题用 c + + c++ 写至少30行,而用 p y t h o n python 8行就搞定了

代码

n, b = [int(x) for x in input().split()]
lis=[]
while n:
    lis.append(str(n%b))
    n//=b
if lis == lis[::-1]: print('Yes')
else: print('No')
print(*lis[::-1])

猜你喜欢

转载自blog.csdn.net/FSAHFGSADHSAKNDAS/article/details/86562413
今日推荐