1 条题解

  • 0
    @ 2024-12-24 9:49:01

    C :

    #include<stdio.h>
    #include<math.h>
    int main()
    {
    	int a, b, c;
    	double res1, res2;
    	scanf("%d%d%d", &a, &b, &c);
    	res1 = ((-b) + sqrt(pow(b, 2) - (4 * a*c))) / ((2)*a);
    	res2 = ((-b) - sqrt(pow(b, 2) - (4 * a*c))) / ((2)*a);
    	if (sqrt(pow(b, 2) - (4 * a*c))==0)
    		printf("%.3lf\n", res1);
    	else if (sqrt(pow(b, 2) - (4 * a*c)) > 0)
    		printf("%.3lf %.3lf\n", res1, res2);
    	else
    		printf("NOANSWER\n");
    	return 0;
    }
    
    
    • 1

    信息

    ID
    818
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者