Fish_redflying @ 2024-05-03 14:39:23
下载数据测都对,怎么交上去全RE?? code
n,m=int(input()),input()
arr=list(m)
accc={'0':0,'1':1,'2':2,'3':3,'4':4,'5':5,'6':6,'7':7,'8':8,'9':9,'A':10,'B':11,'C':12,'D':13,'E':14,'F':15}
arr=[accc[i] for i in arr]
def add(arr,jj,step) :
if step==31 : return "Impossible!"
if list(reversed(arr))==arr : return "STEP="+str(step)
arr2=list(reversed(arr))
arr3=[]
ac=0
for i in range(len(arr)) :
arr3.append((arr[i]+arr2[i]+ac)%jj)
ac=(arr[i]+arr2[i]+ac)//jj
if ac==1 : arr3.append(1)
return add(arr3,jj,step+1)
print(add(arr,n,0))
by sky1105 @ 2024-07-01 16:50:12
dfgffgjhhjhhghj