/ SeriousOJ /

Record Detail

Runtime Error


  
# Status Time Cost Memory Cost
#1 Runtime Error Traceback (most recent call last): File "foo.py", line 30, in <module> ValueError: invalid literal for int() with base 10: '\r' 12ms 2.672 MiB
#2 Runtime Error Traceback (most recent call last): File "foo.py", line 30, in <module> ValueError: invalid literal for int() with base 10: '\r' 12ms 2.836 MiB
#3 Runtime Error Traceback (most recent call last): File "foo.py", line 30, in <module> ValueError: invalid literal for int() with base 10: '\r' 12ms 2.809 MiB
#4 Runtime Error Traceback (most recent call last): File "foo.py", line 30, in <module> ValueError: invalid literal for int() with base 10: '+' 12ms 2.777 MiB
#5 Runtime Error Traceback (most recent call last): File "foo.py", line 30, in <module> ValueError: invalid literal for int() with base 10: '\r' 12ms 2.891 MiB
#6 Runtime Error Traceback (most recent call last): File "foo.py", line 30, in <module> ValueError: invalid literal for int() with base 10: '\r' 12ms 2.68 MiB

Code

s = input()

for _ in range(int(input())):
    x, y = map(int, input().split())
    n = len(s)
    indx = 2
    digit = 0
    m = 0
    c = 0
    neg_m = False
    neg_c = False

    if s[2] == '-':
        neg_m = True
        indx += 1
    while s[indx] != 'x':
        digit = int(s[indx])
        m *= 10
        m += digit
        indx += 1
    if (neg_m):
        m *= (-1)

    indx += 1

    if indx<n and s[indx]== '-':
        neg_c = True
        indx += 1
    while indx < n:
        digit = int(s[indx])
        c *= 10
        c += digit
        indx += 1
    if neg_c:
        c *= (-1)


    if y == (m * x + c):
        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-06 20:35:51
Judged At
2024-01-06 20:35:51
Judged By
Score
0
Total Time
12ms
Peak Memory
2.891 MiB