#9687: 逾時NA


as1232161 (learner)


#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    double a,b,c,d,e;    
    while(1)
    {
     cin>>a;cin>>b;cin>>c;
     d=(b*b-4*a*c);
     
     if(d<0)
     {
     cout<<"No real root"<<endl;
     }
        
     if(d>0)
     {      
      e=pow(d,0.5);
      cout<<"Two different roots   x1="<<(-b+e)/(2*a)<<"x2="<<(-b-e)/(2*a)<<endl;
     }
     else if(d==0)
     {     
      cout<<"Two same roots  x="<<-b/(2*a)<<endl;     
     }                               
    } 
    return 0;   
}
用c++執行OK但是解題時逾時了...要怎麼寫比較好呢?