/ SeriousOJ /

Record Detail

Runtime Error


  
# Status Time Cost Memory Cost
#1 Wrong Answer 13ms 2.777 MiB
#2 Runtime Error Traceback (most recent call last): File "foo.py", line 26, in <module> NameError: name 'R_NEW' is not defined. Did you mean: 'L_NEW'? 13ms 2.891 MiB
#3 Wrong Answer 19ms 2.879 MiB
#4 Accepted 18ms 2.887 MiB
#5 Wrong Answer 18ms 2.855 MiB
#6 Accepted 18ms 2.738 MiB

Code

s=input()
for i in range(int(input())):
    X,Y=map(int,input().split())
    LHS,RHS = s.split('=')
    if 'y' in LHS:
        LHS = LHS.replace('y', '1')
        LHS_NEW=int(LHS)*Y
    else:
        LHS_NEW=int(LHS)
    if 'x' in RHS:
        L,R = RHS.split('x')
        if L=='':
            L_NEW=1*X
        elif L=='-':
            L_NEW=-1*X
        else:
            L_NEW = int(L) * X
        if R!='':
            for i in R:
                if i=='+':
                    R_NEW = int(R)
                elif i=='-':
                    R_NEW = -int(R)
        else:
            R_NEW = 0
        RHS_NEW=L_NEW + R_NEW
    else:
        RHS_NEW=int(RHS)
    if LHS_NEW==RHS_NEW:
        print("YES")
    else:
        print("NO")









Information

Submit By
Type
Submission
Problem
P1015 Friend in need is a friend indeed
Language
Python 3 (Python 3.12.3)
Submit At
2024-01-08 10:59:22
Judged At
2024-01-08 10:59:22
Judged By
Score
30
Total Time
19ms
Peak Memory
2.891 MiB