|
|
back to boardwhy is my python code TLE? anybody give me some advice my code : n = input() num = [0 for i in xrange(n) ] for i in xrange(n): x, y = map(int, raw_input().split()) num[i] = x+y cnt = 0 for i in xrange(n-1, -1, -1): num[i] += cnt cnt = 0 if num[i] > 9 and i > 0: num[i] -= 10; cnt = 1 print ''.join( map(str, num) ) Re: why is my python code TLE? anybody give me some advice Posted by candide 10 May 2013 03:11 As explained in another post, for the following set of data: 4 9 0 5 4 5 4 5 5 the program has to return: 0000 Your code is wrong since it returns: 10000 Re: why is my python code TLE? anybody give me some advice The answer to 4 9 0 5 4 5 4 5 5 is 10000. |
|
|