Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

DIVAB 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 :: to divide or not to divide solution 
Python :: Python recursively find files with specific ext 
Python :: python type checking 
Python :: if key not in dictionary python 
Python :: what is python -u 
Python :: Python NumPy concatenate Function Example when axis equal to 1 
Python :: get hex code of character python 
Python :: pandas in python 
Python :: copy class selenium python 
Python :: python count of values in array 
Python :: formatted string in python 
Python :: slicing strings in python 
Python :: tkinter hide widget 
Python :: remove a first array of item in python 
Python :: Access the elements using the [] syntax nested dictionary 
Python :: Iterate through string in python using for loop and rang 
Python :: enum python string 
Python :: journalctl not showing all python prints 
Python :: sns boxplot ylabelsize 
Python :: how to remove new line in python 
Python :: Reading Custom Delimited 
Python :: how to close ursina screen 
Python :: pandas turn column of list into binary 
Python :: enumerate 
Python :: python submatrix 
Python :: alexa python get slot value 
Python :: pd merge_asof 
Python :: how to change the main diagonal in pandas 
Python :: python defualt error handler 
Python :: logistic regression python family binomial 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =