RSHIFT.py1 (146 Bytes)
I am trying to solve the RSHIFT problem link is https://www.spoj.com/problems/RSHIFT/9

Code :

from sys import stdin,stdout
for _ in range(int(stdin.readline())):
n = int(stdin.readline())
n = n >> 1
stdout.write(str(n)+’\n’)

this code running perfectly in my ide but gives the wrong answer in spoj. Could anyone spot me what I m doing wrong?

  • created

    Jul '21
  • last reply

    Jul '21
  • 1

    reply

  • 516

    views

  • 2

    users

  • 2

    links

I’ve not got AC with this, but my testing suggests there are negative numbers. Check what your code does with the sign bit.