17462022-12-02 13:49:041478Toronyépítés (1,1,3,3)cpp11Elfogadva 50/5017ms11124 KiB
#include <bits/stdc++.h>  
 
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())
 
const int N_MAX = 1000000;
const int MODULO = 20210108;
vector<int> dp(N_MAX);

int main()
{

    int n;
    cin>>n;
    dp[0] = 1;
    dp[1] = 2;
    dp[2] = 4;
    for(int i=3; i<=n; i++){
        dp[i] = ((2*dp[i-1]) % MODULO + (2*dp[i-3]) % MODULO) % MODULO;
    }

    cout<<dp[n];

    return 0;
}
RészfeladatÖsszpontTesztVerdiktIdőMemória
base50/50
1Elfogadva0/06ms9532 KiB
2Elfogadva0/04ms9820 KiB
3Elfogadva3/34ms10024 KiB
4Elfogadva3/34ms10132 KiB
5Elfogadva4/44ms10084 KiB
6Elfogadva4/44ms10080 KiB
7Elfogadva4/417ms10080 KiB
8Elfogadva4/47ms10336 KiB
9Elfogadva4/44ms10416 KiB
10Elfogadva4/44ms10444 KiB
11Elfogadva4/47ms10640 KiB
12Elfogadva4/416ms10672 KiB
13Elfogadva4/416ms10968 KiB
14Elfogadva4/48ms10916 KiB
15Elfogadva2/24ms11124 KiB
16Elfogadva2/24ms11112 KiB