66452023-12-14 20:32:12mmatedJárdakövezés háromféle elemmelcpp17Accepted 30/304ms5632 KiB
#include <bits/stdc++.h>
using namespace std;
#define f(i,k,n) for(int i=k; i<n; i++)
#define ll long long
const int inf = INT_MAX;
const int mod = 2023;
void solve()
{
    int n;
    cin>>n;
    int x[n];
    x[0]=2;
    x[1]=11;
    int y[n];
    y[0]=1;
    y[1]=4;
    f(i,2,n)
    {
        x[i]=(x[i-1]*2 + x[i-2]*3 + y[i-1]*4)%mod;
        y[i]=(y[i-1] + x[i-1] + x[i-2])%mod;
    }
    cout<<x[n-1]<<"\n";
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    //cin>>t;
    while(t--)  solve();
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/03ms2044 KiB
2Accepted0/03ms2092 KiB
3Accepted2/23ms2316 KiB
4Accepted2/23ms2360 KiB
5Accepted2/23ms2496 KiB
6Accepted2/23ms2704 KiB
7Accepted2/23ms2924 KiB
8Accepted2/23ms3152 KiB
9Accepted2/23ms3740 KiB
10Accepted2/23ms3780 KiB
11Accepted2/24ms4548 KiB
12Accepted3/34ms4996 KiB
13Accepted3/33ms3796 KiB
14Accepted3/33ms4112 KiB
15Accepted3/34ms5632 KiB