#811: 一直超過時間


q10242 (劍雪無名)


 

 如題

我寫完之後 系統總是告訴我我的程式執行時間超過一秒

#include <iostream>
#include <math.h>
using namespace std;

int main()
{
while(true)
{
double a,b,c;
cin>>a>>b>>c;
double d=pow(b,2)-(4*a*c);
if(pow(b,2)-(4*a*c)>0)
{
cout<<"Two different roots x1="<<(0-b)+sqrt(d)/2*a<<","<<"x2="<<(0-b)-sqrt(d)/2*a;
}
else if(pow(b,2)-(4*a*c)==0)
{
     cout<<"Two same roots x="<<(0-b)+sqrt(d)/2*a;
}
else if(pow(b,2)-(4*a*c)<0)
{
     cout<<"No real root";
}
}
    system("pause");
    return 0;
}