Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

DIVAB codechef solution

def solution(a,b,n):
    if a%b == 0:
        return -1
    c = n
    if c%a != 0:
        c = n+a-(c%a)
    while not(c%a == 0 and c%b !=0):
        c += a
    return c
for _ in range(int(input())):
    a,b,n = map(int,input().split())
    print(solution(a,b,n))
Comment

PREVIOUS NEXT
Code Example
Python :: NumPy flip Syntax 
Python :: strip() 
Python :: np.hstack in python 
Python :: python = align 
Python :: datetime to unix timestamp python 
Python :: how to tell python to go back to a previous line 
Python :: ipython and virtualenvs 
Python :: python list extend() 
Python :: how to invert a true false array in python 
Python :: for loop 
Python :: django redirect url 
Python :: python googledriver download 
Python :: read dict txt python 
Python :: python warnings as error 
Python :: generate hmach sha256 hash in python 
Python :: how to get all the keys of a dictionary in python 
Python :: cv2.videocapture python set frame rate 
Python :: streamlit - Warning: NumberInput value below has type int so is displayed as int despite format string %.1f. 
Python :: python replace string with int in list 
Python :: index and reversing a sub list in python list 
Python :: pandas define how you want to aggregate each column 
Python :: add prefix to names in directory python 
Python :: Convert Int to String Using str() function 
Python :: python vs java 
Python :: image completion inpainting with python 
Python :: get nonzero min numpy 
Python :: facebook python 
Python :: where is a package stored python 
Python :: debugging python 
Python :: munshi premchand 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =