Runtime Error
Code
s=input()
if s == "":
exit()
elif "=" not in s:
exit()
else:
try:
LHS,RHS = s.split('=')
except ValueError:
exit()
for i in range(int(input())):
try:
X,Y=map(int,input().split())
except ValueError:
continue
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')
L_NEW = int(L)*X
if R!='':
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 07:44:31
- Judged At
- 2024-11-11 03:43:42
- Judged By
- Score
- 0
- Total Time
- 15ms
- Peak Memory
- 3.121 MiB