Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

DIVAB

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 :: to divide or not to divide codechef 
Python :: stop word python 
Python :: lemmatization in nlp 
Python :: df set index 
Python :: match case in python 
Python :: filter query objects by date range in Django 
Python :: rename rows pandas based on condiions 
Python :: check django channels with redis setup 
Python :: values django 
Python :: string to float in python 
Python :: how to create a string in python 
Python :: python rock paper scissors game 
Python :: how to get a row of a dataframe with subset columns in python 
Python :: character in python 
Python :: python list merger 
Python :: numpy 
Python :: IndexError: invalid index to scalar variable. 
Python :: pytorch get non diag element 
Python :: Setting up WingIDE to debug Flask projects 
Python :: saving model 
Python :: Reading Custom Delimited file in python 
Python :: python print exection type 
Python :: acces previous index in cycle python 
Python :: enumerate() 
Python :: pytorch inverse 
Python :: python code to demonstrate inheritance with animal class 
Python :: python try 
Python :: show only integer values matplotlib 
Python :: how to remove axis in matplotlib 
Python :: concat Pandas Dataframe with Numpy array. 
ADD CONTENT
Topic
Content
Source link
Name
2+3 =