Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

To Divide or Not To Divide 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 :: fastest way to take screenshot python 
Python :: python how to delete a variable 
Python :: how to replace a string in python 
Python :: interpreter vs compiler 
Python :: __repr__ in python 
Python :: import permutations 
Python :: dict to tuple 
Python :: django queryset and operator 
Python :: Subset data frame by date 
Python :: dtype function with example 
Python :: django test imagefield 
Python :: how to remove last 2 rows in a dataframe 
Python :: python __repr__ meaning 
Python :: python day of the year 
Python :: How to show variable in Jupyter 
Python :: list functions 
Python :: python if not null 
Python :: matplotlib temperature celsius 
Python :: python for loop in range 01 02 
Python :: inherit functions from other classes 
Python :: 1036 solution python 
Python :: python count one to ten 
Python :: how to plot a single cluster 
Python :: define a string in python 
Python :: import open3d Illegal instruction (core dumped) 
Python :: form field required in django views 
Python :: what is not equals in python 
Python :: set page title name and favicon in streamlit 
Python :: flask tutorial 
Python :: Python3 boto3 put object to s3 
ADD CONTENT
Topic
Content
Source link
Name
5+2 =