QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#374476#3721. Simple AlgebraNYOJ-2AC ✓2ms3628kbC++17991b2024-04-02 14:33:412024-04-02 14:33:42

Judging History

This is the latest submission verdict.

  • [2024-04-02 14:33:42]
  • Judged
  • Verdict: AC
  • Time: 2ms
  • Memory: 3628kb
  • [2024-04-02 14:33:41]
  • Submitted

answer

#include <bits/stdc++.h>
#define ll long long
#define inf 0x3f3f3f3f
#define pll pair<ll, ll>
using namespace std;
const int mod = 1e9 + 7;
const int N = 2e5 + 7;
ll n, m;
void Z()
{
    int a, b ,c;
    while (cin >> a)
    {
        cin >> b >> c;
        bool flag = 0;
        
        if (a < 0)
        {
            cout << "No" << "\n";
        }
        else if (a == 0)
        {
            if (b == 0 && c >= 0)
            {
                cout << "Yes" << "\n";
            }
            else
            {
                cout << "No" << "\n";
            }
        }
        else if (a > 0)
        {
            if (b * b - 4 * a * c <= 0)
            {
                cout << "Yes" << "\n";
            }
            else
            {
                cout << "No" << "\n";
            }
        }
       
    }
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int t = 1;
    //cin >> t;
    while (t--)
    {
        Z();
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3628kb

input:

-10 -10 -10
-10 -10 -9
-10 -10 -8
-10 -10 -7
-10 -10 -6
-10 -10 -5
-10 -10 -4
-10 -10 -3
-10 -10 -2
-10 -10 -1
-10 -10 0
-10 -10 1
-10 -10 2
-10 -10 3
-10 -10 4
-10 -10 5
-10 -10 6
-10 -10 7
-10 -10 8
-10 -10 9
-10 -10 10
-10 -9 -10
-10 -9 -9
-10 -9 -8
-10 -9 -7
-10 -9 -6
-10 -9 -5
-10 -9 -4
-10 -9 ...

output:

No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
...

result:

ok