Can anyone help me find out why am I getting RE status when I submit the
following code?:
def prime_factors(n):
i = 2
factors = []
while i * i <= n:
if n % i:
i += 1
else:
n //= i
factors.append(i)
if n > 1:
factors.append(n)
return factors
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
t = int(input())
for i in range(1, t+1):
n, l = map(int, input().split())
cipher = list(map(int, input().split()))
decipher = prime_factors(cipher[0])
if cipher[1] % decipher[0] == 0:
decipher = decipher[::-1]
answer = []
j = 1
for word in cipher[1:]:
decipher.append(word // decipher[j])
j = j+1
print(decipher)
keys = sorted(list(set(decipher)))
for char in decipher:
answer.append(alpha[keys.index(char)])
print("Case #{}: {}".format(i, ''.join(answer)))
It works fine when I run it on my PC for the sample inputs.
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/aa337bf2-32a1-43f6-8d76-58718ee91e6b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.