Factorization corrected by croyal

while 1:
 l=[]
 r=raw_input().split()
 s=int(r[0])
 m=int(r[1])
 for i in range(1,m+1):
  if m%i==0:
   l+=[i]
 x=0
 y=s
 d=0
 for i in l:
  if d:break
  else:
   for j in l:
    if i+j==s and i*j==m:
     d=1
     x=i
     y=j
     break
 print'%d %d'%(x,y)
         
         

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page