Light Mode
Dark Mode
Feedback from user osa_k
When I run code, the check stops before complete all the process, although there are no wrong answer.
The process is stopped in "FAIL" state after showing "Test 7/7", which for my code produces correct answer, -140558.


My code:
from fractions import Fraction

def checkio(data):
    data = [[Fraction(i) for i in row] for row in data]
    res = Fraction(1)
    for r in range(len(data)):
        res *= data[r][r]
        if data[r][r] == 0:
            return res
        for rr in range(r+1, len(data)):
            ratio = data[rr][r] / data[r][r]
            for c in range(len(data[0])):
                data[rr][c] -= data[r][c] * ratio
    return int(res)



URL from: http://www.checkio.org/mission/determinant/solve/
HTTP_USER_AGENT: Mozilla/5.0 (X11; Linux x86_64; rv:27.0) Gecko/20100101 Firefox/27.0
  • feedback
Created: March 4, 2014, 6:06 p.m.
Updated: March 4, 2014, 11:05 p.m.
0
15
User avatar
osa_k