Submission #39787192


Source Code Expand

Copy
A, X, M = map(int, input().split())
Ax = 1
Ae = A
while X:
if X & 1: Ax = Ax * Ae % M
X >>= 1
Ae = Ae * Ae % M
# print(Ax, pow(A - 1, -1, M))
print((Ax - 1) * pow(A - 1, -1, M) % M)
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
A, X, M = map(int, input().split())

Ax = 1
Ae = A
while X:
  if X & 1: Ax = Ax * Ae % M
  X >>= 1
  Ae = Ae * Ae % M

# print(Ax, pow(A - 1, -1, M))
print((Ax - 1) * pow(A - 1, -1, M) % M)

Submission Info

Submission Time
Task E - Geometric Progression
User arakaki_tokyo
Language Python (3.8.2)
Score 0
Code Size 199 Byte
Status RE
Exec Time 22 ms
Memory 9068 KB

Judge Result

Set Name Sample All AfterContest
Score / Max Score 0 / 0 0 / 500 0 / 0
Status
AC × 3
AC × 13
RE × 18
AC × 1
Set Name Test Cases
Sample sample00.txt, sample01.txt, sample02.txt
All sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt, testcase20.txt, testcase21.txt, testcase22.txt, testcase23.txt, testcase24.txt, testcase25.txt, testcase26.txt, testcase27.txt
AfterContest after_contest_01.txt
Case Name Status Exec Time Memory
after_contest_01.txt AC 22 ms 9008 KB
sample00.txt AC 16 ms 8940 KB
sample01.txt AC 19 ms 8768 KB
sample02.txt AC 18 ms 8832 KB
testcase00.txt AC 22 ms 9008 KB
testcase01.txt RE 19 ms 9060 KB
testcase02.txt AC 17 ms 8928 KB
testcase03.txt RE 19 ms 8860 KB
testcase04.txt AC 18 ms 8760 KB
testcase05.txt AC 18 ms 8932 KB
testcase06.txt AC 20 ms 8948 KB
testcase07.txt AC 18 ms 8956 KB
testcase08.txt RE 18 ms 8936 KB
testcase09.txt RE 16 ms 8760 KB
testcase10.txt RE 17 ms 8948 KB
testcase11.txt RE 16 ms 8756 KB
testcase12.txt RE 19 ms 8760 KB
testcase13.txt RE 18 ms 8756 KB
testcase14.txt AC 17 ms 8884 KB
testcase15.txt AC 18 ms 9008 KB
testcase16.txt RE 17 ms 8892 KB
testcase17.txt RE 21 ms 8760 KB
testcase18.txt RE 20 ms 8764 KB
testcase19.txt AC 18 ms 8956 KB
testcase20.txt RE 18 ms 8756 KB
testcase21.txt RE 20 ms 9004 KB
testcase22.txt AC 16 ms 8932 KB
testcase23.txt RE 17 ms 9060 KB
testcase24.txt RE 22 ms 8952 KB
testcase25.txt RE 17 ms 8888 KB
testcase26.txt RE 16 ms 8764 KB
testcase27.txt RE 18 ms 9068 KB


2025-04-05 (Sat)
11:14:37 +00:00