ProgrammingVery hardProduct-company MCQ pattern
What is printed on the first line?
What is printed on the first line?
M = 10**9 + 7 print((-1) % M, (2**62) % M, pow(3, M - 2, M) * 3 % M) print(((-5) % 3) * ((-5) % 3), (-5 * -5) % 3)
- A. 1000000006 145586002 0
- B. 1000000007 145586002 1
- C. 1000000006 145586002 1
- D. 1000000006 145586003 1
Correct answer: C. 1000000006 145586002 1
(-1) % M is M - 1, and pow(3, M - 2, M) is the modular inverse of 3 by Fermat's little theorem, so multiplying by 3 gives 1 mod M.
More Python Programming questions
- What is printed on the second line? python a, b = -13, 4 print(a // b, a % b, a // b b + a % b == a) print(int(a / b), int(-3.25), -3.25…
- What is printed on the first line? python n = -17 print(n >> 2, n // 4, n & 3, n % 4) print(n << 1, (n << 1) >> 1 == n, ~n)
- What is printed on the first line? python x = 1 for in range(70): x = 2 print(x, x.bitlength(), x == 270) print(x.bitlength() - 1, (x…
- What is printed on the first line? python import math print(math.factorial(20) == 2432902008176640000, len(str(math.factorial(25))))…
- What is printed on the first line? python n = 264 print(n, n.bitlength(), hex(n - 1), oct(8), bin(5)) print(int(hex(n)[2:], 16) == n, -263…
- What is printed on the first line? python print(int('1' 19) + 1, 1018 10, 9223372036854775807 + 1 > 263 - 1) print(2100 // 298, (2100) >>…