63272023-11-18 16:58:32kukkermanJárda-L (40)cpp14Accepted 40/403ms4468 KiB
#include <iostream>

int beolvas(std::istream &in) {
    int n;
    in >> n;

    return n;
}

int jarda(int n) {
    int t2 = 1, t1 = 1, h1 = 0;
    for (auto i = 2; i <= n; i++) {
        const auto t0 = t2 + t1 + h1;
        const auto h0 = 2 * t2 + h1;
        t2 = t1;
        t1 = t0;
        h1 = h0;
    }

    return t1;
}

void feldolgoz(int n) {
    std::cout << jarda(n) << std::endl;
}

int main() {
    const auto n = beolvas(std::cin);
    feldolgoz(n);

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1876 KiB
2Accepted0/03ms2120 KiB
3Accepted2/23ms2288 KiB
4Accepted2/23ms2504 KiB
5Accepted2/23ms2720 KiB
6Accepted2/23ms2936 KiB
7Accepted2/23ms3052 KiB
8Accepted3/33ms3268 KiB
9Accepted3/33ms3500 KiB
10Accepted3/33ms3560 KiB
11Accepted3/33ms3664 KiB
12Accepted3/33ms3800 KiB
13Accepted3/33ms3780 KiB
14Accepted3/33ms4036 KiB
15Accepted3/33ms4004 KiB
16Accepted3/33ms4248 KiB
17Accepted3/33ms4468 KiB