14922022-11-20 16:41:451478Járda-L (40)cpp11Elfogadva 40/403ms3760 KiB
#include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <random>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <stack>
#include <iomanip>
#include <fstream>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> p32;
typedef pair<ll, ll> p64;
typedef pair<double, double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int>> vv32;
typedef vector<vector<ll>> vv64;
typedef vector<vector<p64>> vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
ll MOD = 998244353;
double eps = 1e-12;
#define forn(i, e) for (ll i = 0; i < e; i++)
#define forsn(i, s, e) for (ll i = s; i < e; i++)
#define rforn(i, s) for (ll i = s; i >= 0; i--)
#define rforsn(i, s, e) for (ll i = s; i >= e; i--)
#define ln "\n"
#define dbg(x) cout << #x << " = " << x << ln
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define INF 2e18
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())

int main()
{
    // ifstream cin("be.txt");
    int n;;
    cin >> n;
    vector<int> f(n + 1), g(n + 1);
    f[0] = 1;
    f[1] = 1;
    g[1] = 1;
    for (int i = 2; i <= n; i++)
    {
        f[i] = f[i - 1] + f[i - 2] + 2 * g[i - 2];
        g[i] = f[i - 1] + g[i - 1];
    }
    cout << f[n];

    return 0;
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base40/40
1Elfogadva0/03ms1816 KiB
2Elfogadva0/02ms2000 KiB
3Elfogadva2/22ms2252 KiB
4Elfogadva2/22ms2408 KiB
5Elfogadva2/22ms2616 KiB
6Elfogadva2/22ms2824 KiB
7Elfogadva2/22ms2936 KiB
8Elfogadva3/32ms3072 KiB
9Elfogadva3/32ms3144 KiB
10Elfogadva3/32ms3148 KiB
11Elfogadva3/32ms3096 KiB
12Elfogadva3/32ms3372 KiB
13Elfogadva3/32ms3364 KiB
14Elfogadva3/32ms3420 KiB
15Elfogadva3/32ms3436 KiB
16Elfogadva3/32ms3508 KiB
17Elfogadva3/32ms3760 KiB