Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Найти максимальное 14-ричное четное число
- s = open('24.txt').readline()
- S = s
- #alph = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
- for e in 'EFGHIJKLMNOPQRSTUVWXYZ':
- s = s.replace(e, '!')
- s = s.split('!')
- print(s[:100])
- a = []
- for e in s:
- #if len(s) == 0:
- # continue
- ind = -1
- for i in range(len(e) - 1, -1, -1): #перебираем положительные индексы с конца
- #for i in range(-1, -len(e)-1, -1): #перебираем отрицательные индексы с конца
- if e[i] in 'AC02468':
- ind = i
- break
- if ind != -1:
- a.append(e[:ind+1])
- mx = '0'
- for e in a:
- if int(e, 14) > int(mx, 14):
- mx = e
- print(S.index(mx))
Advertisement
Add Comment
Please, Sign In to add comment