315952026-09-09 19:43:33Kristof0306Járda-L (40)cpp17Elfogadva 40/401ms508 KiB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using pll = pair<ll,ll>;
using vll = vector<ll>;
using vi = vector<int>;
using pi = pair<int, int>;
using vpi = vector<pair<int, int>>;
using vai = vector<array<int, 3>>;

#define x first
#define y second
#define all(x) x.begin(), x.end()

void solve() {
    int n; cin >> n;
    vector<pll> dp(n+3);
    dp[0].x = 1;
    for (int i = 0; i < n; i++) {
        dp[i+1].x += dp[i].x;
        dp[i+1].y += dp[i].y;
        dp[i+1].y += dp[i].x*2;
        dp[i+2].x += dp[i].y;
        dp[i+2].x += dp[i].x;
    } cout << dp[n].x;
}

int main() {
	ios::sync_with_stdio(0);
    cin.tie(0);

    int t=1;
    //cin >> t;
    while (t--) {
        solve();
    }
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base40/40
1Elfogadva0/01ms316 KiB
2Elfogadva0/01ms316 KiB
3Elfogadva2/21ms508 KiB
4Elfogadva2/21ms316 KiB
5Elfogadva2/21ms316 KiB
6Elfogadva2/21ms316 KiB
7Elfogadva2/21ms316 KiB
8Elfogadva3/31ms316 KiB
9Elfogadva3/31ms316 KiB
10Elfogadva3/31ms316 KiB
11Elfogadva3/31ms316 KiB
12Elfogadva3/31ms316 KiB
13Elfogadva3/31ms316 KiB
14Elfogadva3/31ms316 KiB
15Elfogadva3/31ms316 KiB
16Elfogadva3/31ms508 KiB
17Elfogadva3/31ms316 KiB