Submission #64549561


Source Code Expand

Copy
N, M = map(int, input().split(" "))
X = 0
for i in range(M+1):
X += (N**i)
if X > (10**9):
X = "inf"
break
print(X)
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
N, M = map(int, input().split(" "))

X = 0

for i in range(M+1):
    X += (N**i)
    if X > (10**9):
        X = "inf"
        break

print(X)

Submission Info

Submission Time
Task B - Sum of Geometric Series
User ayusan
Language Python (CPython 3.11.4)
Score 200
Code Size 152 Byte
Status AC
Exec Time 10 ms
Memory 8736 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 4
AC × 37
Set Name Test Cases
Sample sample00.txt, sample01.txt, sample02.txt, sample03.txt
All sample00.txt, sample01.txt, sample02.txt, sample03.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, testcase28.txt, testcase29.txt, testcase30.txt, testcase31.txt, testcase32.txt
Case Name Status Exec Time Memory
sample00.txt AC 9 ms 8528 KB
sample01.txt AC 9 ms 8536 KB
sample02.txt AC 9 ms 8592 KB
sample03.txt AC 9 ms 8500 KB
testcase00.txt AC 9 ms 8552 KB
testcase01.txt AC 9 ms 8576 KB
testcase02.txt AC 10 ms 8572 KB
testcase03.txt AC 10 ms 8500 KB
testcase04.txt AC 9 ms 8492 KB
testcase05.txt AC 10 ms 8524 KB
testcase06.txt AC 9 ms 8472 KB
testcase07.txt AC 10 ms 8544 KB
testcase08.txt AC 9 ms 8444 KB
testcase09.txt AC 9 ms 8496 KB
testcase10.txt AC 9 ms 8532 KB
testcase11.txt AC 9 ms 8736 KB
testcase12.txt AC 9 ms 8496 KB
testcase13.txt AC 9 ms 8472 KB
testcase14.txt AC 9 ms 8484 KB
testcase15.txt AC 9 ms 8476 KB
testcase16.txt AC 9 ms 8604 KB
testcase17.txt AC 9 ms 8540 KB
testcase18.txt AC 9 ms 8520 KB
testcase19.txt AC 10 ms 8552 KB
testcase20.txt AC 9 ms 8428 KB
testcase21.txt AC 9 ms 8496 KB
testcase22.txt AC 10 ms 8588 KB
testcase23.txt AC 9 ms 8660 KB
testcase24.txt AC 9 ms 8496 KB
testcase25.txt AC 9 ms 8492 KB
testcase26.txt AC 10 ms 8528 KB
testcase27.txt AC 9 ms 8612 KB
testcase28.txt AC 9 ms 8512 KB
testcase29.txt AC 9 ms 8500 KB
testcase30.txt AC 9 ms 8536 KB
testcase31.txt AC 9 ms 8428 KB
testcase32.txt AC 10 ms 8496 KB


2025-04-26 (Sat)
21:33:54 +00:00