67452023-12-18 16:27:45111Járdakövezés háromféle elemmelcpp17Accepted 30/304ms7104 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define double long double

#define pii pair<int, int>

signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
#ifdef CB
	freopen("be2.txt", "r", stdin);
//	freopen("out.txt", "w", stdout);
#endif
	int N;
	cin >> N;
	int v[N + 1][2];
	v[0][0] = 1;
	v[0][1] = 1;
	v[1][0] = 2;
	v[1][1] = 4;
	for (int i = 2; i <= N; i++) {
		v[i][0] = (v[i - 2][0] + v[i - 1][1] * 2 + v[i - 2][1] * 2) % 2023;
		v[i][1] = (v[i - 1][0] + v[i - 1][1] + v[i][0]) % 2023;
	}
	cout << v[N][0] << '\n';
	return 0;
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/03ms1888 KiB
2Accepted0/03ms2088 KiB
3Accepted2/23ms2184 KiB
4Accepted2/23ms2396 KiB
5Accepted2/23ms2608 KiB
6Accepted2/23ms2832 KiB
7Accepted2/23ms3068 KiB
8Accepted2/23ms3044 KiB
9Accepted2/23ms3836 KiB
10Accepted2/23ms4212 KiB
11Accepted2/24ms5476 KiB
12Accepted3/34ms6064 KiB
13Accepted3/33ms3916 KiB
14Accepted3/33ms4032 KiB
15Accepted3/34ms7104 KiB