209782026-01-11 22:45:36zsomborJárdakövezés háromféle elemmelcpp17Accepted 30/303ms1076 KiB
#include <bits/stdc++.h>
using namespace std;

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