Submission #64502246


Source Code Expand

Copy
n, m = map(int, input().split())
ans = 0
tmp = 1
for i in range(m + 1):
ans += tmp
tmp *= n
if ans > 10**9:
print("inf")
else:
print(ans)
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
n, m = map(int, input().split())
ans = 0
tmp = 1
for i in range(m + 1):
    ans += tmp
    tmp *= n
if ans > 10**9:
    print("inf")
else:
    print(ans)

Submission Info

Submission Time
Task B - Sum of Geometric Series
User juten
Language Python (PyPy 3.10-v7.3.12)
Score 200
Code Size 164 Byte
Status AC
Exec Time 57 ms
Memory 76632 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 56 ms 76440 KB
sample01.txt AC 56 ms 76400 KB
sample02.txt AC 56 ms 76620 KB
sample03.txt AC 57 ms 76300 KB
testcase00.txt AC 56 ms 76496 KB
testcase01.txt AC 57 ms 76268 KB
testcase02.txt AC 56 ms 76476 KB
testcase03.txt AC 56 ms 76580 KB
testcase04.txt AC 56 ms 76568 KB
testcase05.txt AC 55 ms 76272 KB
testcase06.txt AC 55 ms 76608 KB
testcase07.txt AC 55 ms 76424 KB
testcase08.txt AC 55 ms 76484 KB
testcase09.txt AC 55 ms 76596 KB
testcase10.txt AC 55 ms 76384 KB
testcase11.txt AC 55 ms 76448 KB
testcase12.txt AC 55 ms 76440 KB
testcase13.txt AC 56 ms 76280 KB
testcase14.txt AC 56 ms 76432 KB
testcase15.txt AC 56 ms 76376 KB
testcase16.txt AC 55 ms 76288 KB
testcase17.txt AC 56 ms 76292 KB
testcase18.txt AC 55 ms 76632 KB
testcase19.txt AC 56 ms 76204 KB
testcase20.txt AC 55 ms 76324 KB
testcase21.txt AC 56 ms 76552 KB
testcase22.txt AC 56 ms 76328 KB
testcase23.txt AC 55 ms 76296 KB
testcase24.txt AC 56 ms 76628 KB
testcase25.txt AC 56 ms 76292 KB
testcase26.txt AC 56 ms 76460 KB
testcase27.txt AC 56 ms 76604 KB
testcase28.txt AC 56 ms 76576 KB
testcase29.txt AC 56 ms 76604 KB
testcase30.txt AC 56 ms 76308 KB
testcase31.txt AC 55 ms 76552 KB
testcase32.txt AC 56 ms 76288 KB


2025-04-07 (Mon)
15:43:45 +09:00