Sort by

recency

|

7 Discussions

|

  • + 0 comments

    I don't why there is Run Time ERROR (for higher values of a,b,c) even in time complexicity O(n).

    for _ in range(int(input())):
        a,b,c=map(int,input().split())
        x=int(c/(a+(b/a)*b))
        m,n=x,x
        while True:
            if m>0:
                y=(c-a*m)/b
                if y==int(y):
                    print(str(m)+" "+str(int(y)))
                    break
                m-=1
            y=(c-a*n)/b
            if n>0 and y==int(y):
                print(str(n)+" "+str(int(y)))
                break
            n+=1
    
  • + 0 comments

    This is not a geometry exercise

  • + 1 comment

    Hi,

    There seems to be something wrong with this problem :

    The linear diophantine equation a*x+b*y=c hasn't always integer solutions, if no constraint at all is imposed to a, b, and c.

    The following wikipedia article (in french) explains it :

    linear diophantine equation (french)

    Sorry, but the article on Wikipedia is only available in French.

    Best regards

  • + 0 comments

    can anybody give some hints?

  • + 4 comments

    I think there is another error in the testcases.

    Testcase 2

    • Item #12
    • Input: 4 1 82
    • Testcase Solution: 19 6 (4*19+6 = 82)
    • Correct Solution: 1 78 (4*1+78 = 82)

    Testcase 3

    • Item #73
    • Input: 30 3 69
    • Testcase Solution: 2 3 (2*30 + 3*3 = 69)
    • Correct Solution: 1 13 (1*30 + 13*3 = 69)