227362026-01-15 17:34:06algoproJárdakövezés háromféle elemmelcpp17Accepted 30/303ms1104 KiB
// UUID: 5c9f873b-69cb-4501-a67f-4e97ac122d3c
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n; cin >> n;
    vector<int> a(n+2, 0), b(n+2, 0);
    a[1] = 1;
    b[1] = 2;
    a[0] = 0;
    b[0] = 1;
    for (int i=2;i<n+2;i++) {
        a[i] = (b[i - 1] + b[i-2] + a[i-1]) %2023;
        b[i] = (a[i] + b[i-1] +a[i-1] + b[i-2] + a[i-1] + a[i-1] + b[i-2] )%2023;
    }
    cout << b[n] << '\n';
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/01ms512 KiB
2Accepted0/01ms316 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms508 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Accepted2/21ms316 KiB
8Accepted2/21ms316 KiB
9Accepted2/21ms496 KiB
10Accepted2/22ms564 KiB
11Accepted2/22ms820 KiB
12Accepted3/33ms820 KiB
13Accepted3/31ms316 KiB
14Accepted3/31ms476 KiB
15Accepted3/33ms1104 KiB