#34418: python正解


yorkyork0611@gmail.com (201-13謝宗侑)

School : No School
ID : 225809
IP address : [114.26.94.17]
Last Login :
2023-06-16 14:41:03
a006. 一元二次方程式 | From: [114.26.57.76] | Post Date : 2023-03-17 15:55

自己不會打喔

還想抄解答

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

好啦 解答在這

import math

a, b, c = map(int, input().split())

delta = b**2 - 4*a*c

print(f"Two different roots x1={int((-b + math.sqrt(delta)) / (2*a))} , x2={int((-b - math.sqrt(delta)) / (2*a))}" if delta > 0 else f"Two same roots x={int(-b / (2*a))}" if delta == 0 else "No real root")

 
ZeroJudge Forum