fork download
  1. from math import *
  2. a = map(str,raw_input().split())
  3. b = a[2] ; c = int(a[4]) ; b = int(b[0:len(b)-1])
  4. ans1 = (-(b)+sqrt(b**2-4*c))/2
  5. ans2 = (-(b)-sqrt(b**2-4*c))/2
  6. ans1,ans2 = -(int(ans1)),-(int(ans2))
  7. ans = "(x+"+str(ans1)+")(x+"+str(ans2)+")"
  8. print ans
Success #stdin #stdout 0.08s 10928KB
stdin
x^2 + 4x + 3
stdout
(x+1)(x+3)