1104 Time Limit Python 3
1104 Task
Help me please, I cant understand how can i do my calculations faster?
I think that problem with slow input, but how else can i write it?
p.s. using stdin, stdout get Time Limit as well
maximal = 0
max_digit = -1
arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', \
'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', \
'U', 'V', 'W', 'X', 'Y', 'Z']
for s in input():
number = arr.index(s)
if max_digit < number:
max_digit = number
maximal += number
if max_digit == 0:
print(2)
else:
answer = ''
for k in range(max_digit, 37):
if not maximal % k:
answer = k + 1
break
if answer == '':
print('No solution.')
else:
print(answer)
Edited by author 14.10.2019 07:30
Edited by author 14.10.2019 07:41