Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def dl(a):
- '''a: integer'''
- n = 0
- while a != 0:
- n += 1
- a //= 10
- return n
- a=int(input())
- b=a
- d=1
- while b!=0:
- c=b%10
- if c%2==0:
- d=(d*10)+c
- b//=10
- d%=(10**(dl(d)-1))
- ans=1
- for i in range(dl(a)):
- a1=a//(10**(dl(a)-1))
- a%=(10**(dl(a)-1))
- if a1%2!=0:
- ans=(ans*10)+a1
- else:
- ans=(ans*10)+(int(d//(10**(dl(d)-1))))
- d%=(10**(dl(d)-1))
- if d>0:
- ans=(ans*10)+d
- ans%=(10**(dl(ans)-1))
- print(int(ans))
- '''если в числе есть нули то не работает, не знаю что не так'''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement