Untitled

mail@pastecode.io avatar
unknown
plain_text
15 days ago
698 B
4
Indexable
Never
int a, b, c, d, v;
void tinh()
{
    int x = v * d - b, y = a - v * c;
    double res = (double)x / y;
    if(res * c + d == 0)
    {
        cout << "NONE";
        return;
    }
    int n = __gcd(x, y);
    x /= n;
    y /= n;
    if(y < 0)
    {
        x = -x;
        y = -y;
    }
    cout << x << "/" << y;
}
Chris_No_Luv
{
    cin >> a >> b >> c >> d >> v;
    if(a - v * c != 0)
    {
        tinh();
        return 0;
    }
    else
    {
        if(v * d - b == 0)
        {
            cout << "MULTIPLE";
            return 0;
        }
        else
        {
            cout << "NONE";
            return 0;
        }
    }
    return 0;
}
Leave a Comment