ProgrammingVery hardCodeforces-style · placement coding round

What is printed?

What is printed?
import math
n = 10**16 - 1
print(math.isqrt(n), int(n ** 0.5))
  1. A. 100000000 100000000
  2. B. 99999999 99999999
  3. C. 99999999 100000000
  4. D. 100000000 99999999

Correct answer: C. 99999999 100000000

10^16 - 1 is too large for an exact float, so the float square root rounds up to 10^8. math.isqrt works on integers exactly and returns 99999999.

More Python Programming questions

Exams that ask this topic