#27633: 一元二次


lmama0813@gmail.com (良い夢を)


#include<stdio.h>
#include<math.h>

int main(){
    int a, b, c; //ax^2+bx+c=0
    int x1,x2,K; 
    scanf("%d %d %d",&a,&b,&c);
    x1 = (b*-1+sqrt(pow(b,2)-4*a*c))/(2*a) ;  // sqrt(x): x 開平方
    x2 = (b*-1-sqrt(pow(b,2)-4*a*c))/(2*a) ;  // pow(X,Y): X 的 Y 次方
    K = pow(b,2)-4*a*c ;
    if(K>0){
        printf("Two different roots x1=%d , x2=%d",x1,x2) ;
    }else if(K==0){
        printf("Two same roots x=%d",x1) ;
    }else if(K<0){
        printf("No real root") ;
    }
    return 0;
}