meng_yiran @ 2025-01-10 17:57:12
n=int(input())
num=list(input())
ans=True
for i in range(len(num)):
if num[i].isdigit():
num[i]=int(num[i])
else:
num[i]=ord(num[i])-ord('A')+10
for i in range(1,31):
num_fan=num[::-1]
for ii in range(len(num)-1,-1,-1):
yushu=(num[ii]+num_fan[ii])//n
num[ii]=(num[ii]+num_fan[ii])%n
if ii==0 and yushu!=0:
num.insert(0,yushu)
elif ii!=0:
num[ii-1]+=yushu
if num==num[::-1]:
print('STEP='+str(i))
ans=False
break
if ans:
print('Impossible!')
真的不知道怎么回事,上次校选拔也有个回文的题目死活过不了,求求大佬指点一下,我第一个数据下载下来答案是4,但我输出的答案也是4,就一模一样的
by meng_yiran @ 2025-01-10 18:15:12
ai转cpp过了。。。。。。。。但还是想知道py哪里不对,求求各位大佬了