222562026-01-14 18:52:05algoproJárda-L (40)pypy3Runtime error 36/4071ms22776 KiB
# UUID: 942ced1d-0b58-465d-8c08-8a5a17d1e075
n = int(input())
a = [0]*n 
a[0] = 1
a[1] = 2
a[2] = 5
a[3] = 11
if n > 4:
    for i in range(4, n):
        a[i] = (a[i-1] - a[i-2])*2 + (a[i-3] - a[i - 4]) + a[i-1]
    print(a[n-1])
else:
    print(a[n-1])

# van egyszerubb keplet: a[i] = 2*a[i-1] + a[i-3], ebbol a tied levezetheto







# 1 = 1, 2 = 2, 3 = 5, 4 = 11, 5 = 24, 6 = 53,
#     1      3      6      13      29
SubtaskSumTestVerdictTimeMemory
base36/40
1Runtime error0/065ms22760 KiB
2Accepted0/043ms19404 KiB
3Runtime error0/271ms22776 KiB
4Runtime error0/265ms22584 KiB
5Accepted2/239ms19500 KiB
6Accepted2/243ms19468 KiB
7Accepted2/243ms19328 KiB
8Accepted3/339ms19428 KiB
9Accepted3/339ms19436 KiB
10Accepted3/343ms19464 KiB
11Accepted3/343ms19352 KiB
12Accepted3/343ms19532 KiB
13Accepted3/345ms19504 KiB
14Accepted3/337ms19300 KiB
15Accepted3/337ms19360 KiB
16Accepted3/343ms19488 KiB
17Accepted3/343ms19436 KiB