70462023-12-28 21:43:08kukkermanJárda-L (40)cpp17Accepted 40/403ms3444 KiB
#include <iostream>
#include <array>

constexpr int N = 28;

constexpr std::array<int, N + 1> jarda() {
    std::array<int, N + 1> j{ 1, 1 };

    int h = 0;
    for (int i = 2; i <= N; i++) {
        j[i] = j[i - 2] + j[i - 1] + h;
        h += 2 * j[i - 2];
    }

    return j;
}

static constexpr auto j = jarda();

int main() {
    int n;
    std::cin >> n;
    std::cout << j[n] << std::endl;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1876 KiB
2Accepted0/03ms2124 KiB
3Accepted2/23ms2360 KiB
4Accepted2/23ms2516 KiB
5Accepted2/23ms2604 KiB
6Accepted2/23ms2596 KiB
7Accepted2/23ms2732 KiB
8Accepted3/33ms2932 KiB
9Accepted3/33ms2924 KiB
10Accepted3/33ms2956 KiB
11Accepted3/33ms3080 KiB
12Accepted3/33ms3208 KiB
13Accepted3/33ms3360 KiB
14Accepted3/33ms3332 KiB
15Accepted3/33ms3316 KiB
16Accepted3/33ms3444 KiB
17Accepted3/33ms3316 KiB