2 条题解

  • 0
    @ 2024-10-13 21:00:34
    #include <iostream>
    using namespace std;
    
    int main() {
        // 输入一元二次方程的系数 a、b、c
        int a, b, c;
        cin >> a >> b >> c;
    
        // 计算判别式
        int discriminant = b * b - 4 * a * c;
    
        // 如果判别式大于等于 0,说明方程有解,输出 yes
        if (discriminant >= 0) {
            cout << "yes" << endl;
        } else {
            // 否则方程无解,输出 no
            cout << "no" << endl;
        }
        return 0;
    }
    
    • 0
      @ 2024-8-8 20:28:35
      #include<iostream>
      using namespace std;
      int main(){
      	int a,b,c;
      	cin>>a>>b>>c;
      	if (b*b-4*a*c>=0){
      		cout<<"yes";
      	}else{
      		cout<<"no";
      	}
      	return 0;
      }
      
      • 1

      信息

      ID
      46
      时间
      1000ms
      内存
      256MiB
      难度
      1
      标签
      递交数
      52
      已通过
      46
      上传者