TOPIC

Wrong ans 5% [Python 3.7]

Adnan Khan Akib asked 10 months ago

Passed everything as far i found, but submission says 5% wrong but WHY?

a,b = map(int,input().split())
if a<0:
    e=b
    if b<0:
        e=b*-1
    while(r<e):
        r+=1
        f=a-r
        if f%b==0:
            break
    q = f/b
else:
    q=a/b
    r=abs(a)%abs(b)
print("{} {}".format(int(q),int(r)))

Remember not post solutions. Your post may be reviewed by our moderators.

  • Samantha Medeiros replied 3 weeks ago

    Hello! My code was similar to yours and it was accepted, try rewriting this:

    Instead of a while loop, i used a for loop (for r in range(e):)

    And @ the else part, try use:

    q = (a - (abs(a) % abs(b))) // b
     r = abs(a) % abs(b)