youngbobo687 9/30/2023 3:56:21 AM
Code mình sai chỗ nào vậy , khi test cs 7/10 đug thôi Link: oj.luyencode.net/problem/DK07 =========================================== #include #include #include int main(){ double a,b,c; std::cin >> a >> b >> c; double delta = pow(b,2) - (4*a*c); if(delta < 0 || a == 0){ std::cout << "NO"; return 0; } if(delta == 0) std::cout << std::fixed << std::setprecision(2) << (-b)/(2*a); else{ double x1, x2; x1 = (-b+sqrt(delta))/(2*a); x2 = (-b-sqrt(delta))/(2*a); if(x1 < x2){ std::cout << std::fixed << std::setprecision(2) << x1 << " " << x2; } else{ std::cout << std::fixed << std::setprecision(2) << x2 << " " << x1; } } }