#27230: 求前輩們提點,測試時都是ac,但送出答案後卻出現NA80%,請問我是漏掉了甚麼??


ssnow1144@gmail.com (wanna be a rock)


import codecs
import sys
from math import *
sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach())

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

# 若要用sqrt() 需先引入模組 import math 或 from maht import *
# 亦或是用 i**0.
i = int(b**2 - 4*a*c)

if i>0 :
    i = int(sqrt(i))
    j = int((-b + i)/2*a)
    k = int((-b - i)/2*a
    if k>j:
        i,j = j,i
    print("Two different roots x1=" + str(j) + " , " + "x2=" + str(k))
elif i == 0 :
    j = int(-b/2*a)
    print("Two same roots x=" + str(j))
else :
    print("No real root")
#27232: Re:求前輩們提點,測試時都是ac,但送出答案後卻出現NA80%,請問我是漏掉了甚麼??


406490150@gms.tku.edu.tw (我是朱朱)


2a 分之 負b 正負根號 b平方 減 四ac

 

你的2a沒有括號刮起來