Help me in solving FINDK3 problem

My issue

I can’t understanding the what was chef wants to declare in finding A and B , can any one let the problem in my if-condition?

My code

# cook your dish here
t = int(input())
for i in range(t):
    x,y,z = map(int,input().split())
    if(x*y%z==0):
        a=x*y
        b=z
        print(a,b)
    elif(y*z%x==0):
        a=y*z
        b=x
        print(a,b)
    elif(z*x%y==0):
        a=z*x
        b=y
        print(a,b)
    else:
        print(-1)

Problem Link: FINDK3 Problem - CodeChef

@satya_praveen

Maybe try adding brackets so determine order of operation.

Here is my code for reference.

# cook your dish here
for _ in range(int(input())):
    x,y,z=map(int,input().split())
    if(((x*y)%z)==0):
        print((x*y),z)
    elif(((x*z)%y)==0):
        print((x*z),y)
    elif(((y*z)%x)==0):
        print((y*z),x)
    else:
        print(-1)
    
1 Like