/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 1ms 524.0 KiB
#3 Wrong Answer 1ms 320.0 KiB
#4 Wrong Answer 1ms 324.0 KiB

Code

#include <bits/stdc++.h>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define pb push_back
#define ll long long int
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
#define mx_ele(v) *max_element(v.begin(),v.end())
#define mnm_ele(v) *min_element(v.begin(),v.end())
#define endl "\n"
using namespace std;

void smile()
{
    string eqn;
    cin >> eqn;
    int slope = 0, c = 0;

    if (eqn.size() == 6)
    {
        eqn[2] = eqn[2] - '0';
        eqn[5] = eqn[5] - '0';
        slope = eqn[2];
        c = eqn[5];
        if (eqn[4] == '-')
            c = (-1) * c;
    }
    else if (eqn.size() == 7)
    {
        eqn[3] = eqn[3] - '0';
        eqn[6] = eqn[6] - '0';
        slope = (-1) * eqn[3];
        c = eqn[6];
        if(eqn[5]=='-')
        c=(-1)*c;
        
    }
    else if (eqn.size() == 5 and eqn[2]!='x')
    {
        eqn[3] = eqn[3] - '0';
        slope = eqn[3];
        if (eqn[2] == '-')
            slope = (-1) * slope;
        c = 0;
    }
    else if(eqn.size()==5 and eqn[2]=='x')
    {
    slope=1;
    eqn[4]-'0';
    c=eqn[3];
    }
    else if (eqn.size() == 4 and eqn[3] == 'x')
    {
        eqn[2] = eqn[2] - '0';
        slope = eqn[2];
        c = 0;
    }
    else if (eqn.size() == 3)
    {
        eqn[2] = eqn[2] - '0';
        slope = 0;
        c = eqn[2];
    }
    else if (eqn.size() == 4)
    {
        slope = 0;
        eqn[3] = eqn[3] - '0';
        c = (-1) * eqn[3];
    }
    int t;cin>>t;
    while(t--)
    {
    int x,y;
    cin>>x>>y;
    int first=slope*x;
    int fina=first+c;
    if(fina==y)
    yes;
    else no;
    }
    }

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int T = 1;
    // cin >> T;
    while (T--)
    {
        smile();
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1015 Friend in need is a friend indeed
Contest
Brain booster - 1
Language
C++17 (G++ 13.2.0)
Submit At
2023-12-31 16:02:40
Judged At
2024-11-11 03:45:18
Judged By
Score
30
Total Time
1ms
Peak Memory
532.0 KiB