Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

Maximize Difference

# MD Murad Hossain
# Gamil: muradhossainm01@gmail.com
# Accepted Ho ja:

try:
    for _ in range(int(input())):
        n,m = map(int,input().split())
        if m < 2*n:
            print(m,m)
        elif m >= 2*n and m%n == 0:
            print(m,n)
        else:
            res = 0
            res_2 = 0
            div = m//2
            if m >= 2*n:
                div = 2*n
            Min = 0
            for i in range(n,div):
                d = m//i
                c_Min = (i*d)-i
                if c_Min > Min:
                    res = i
                    res_2 = i*d
                    Min = c_Min
            print(res,res_2)
except:
    pass
Comment

PREVIOUS NEXT
Code Example
Python :: sns swarm plot 
Python :: id3 algorithm code in python 
Python :: sqlite3 python parameterized query insert into 
Python :: how to get one record in django 
Python :: cascaed models in django 
Python :: what is indentation in python 
Python :: Python Join Lists 
Python :: run python in c ++ 
Python :: remove occurence of character from string python 
Python :: python import from string name 
Python :: Count Zero 
Python :: boto3 python s3 
Python :: hierarchy dendrogram 
Python :: python create unreadable save file 
Python :: font tkinter combobox 
Python :: Changing default fonts in matploitlibrc file 
Python :: python increase one item in list 
Python :: python referenced before assignment in function 
Python :: how should i learn python 
Python :: json payload python function 
Python :: python list remove duplicates keep order 
Python :: how to print a message in python 
Python :: pyqt click through window 
Python :: for each in python 
Python :: different types f python loops 
Python :: how to create dynamic list in python 
Python :: binary search tree in python 
Python :: python how to exit function 
Python :: implement stack using list in python 
Python :: qr code detector 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =