1 / 3
Apr 2010

I am almost sure the reason for WA is that its not printing all the digits for values with high precision
for ex - 9.5367431640625e-07
Is there any way in Python to ensure that all the digits are printed instead of in an exponential form, while ensuring that there are no trailing zeroes ?

test = int(sys.stdin.readline().strip())
	for t in xrange(0,test):
		n = int(sys.stdin.readline().strip())
		result = 2*0.5**n
		print result
  • created

    Apr '10
  • last reply

    May '10
  • 2

    replies

  • 136

    views

  • 3

    users

Look at the constraints: n <= 1000!
You can't solve it using floats.

1 month later

instead of multiplying by 0.5 u can multiply by 5 and divide by 10....dividing by 10 is nothing but shifting the decimal point by 1 place to the left....thts enough of a hint i guess....