14812022-11-10 17:16:20lacitoToronyépítés (2,2,3,3)cpp11Accepted 40/404ms5572 KiB
#include <bits/stdc++.h>
using namespace std;

int MOD = 20210108;

int main() {
	int n;
	cin >> n;
	vector<int> torony;
	torony.push_back(2); 
	torony.push_back(2);
	torony.push_back(4);
	for (int i = 3; i < n; i++) {
		torony.push_back((2*torony[i-3]+2*torony[i-2])%MOD);
	} 
	if (n < 2) {
		cout << 0;
	} else {
		cout << torony[n-2];
	}
}
SubtaskSumTestVerdictTimeMemory
base40/40
1Accepted0/03ms1812 KiB
2Accepted0/02ms2068 KiB
3Accepted2/22ms2224 KiB
4Accepted2/22ms2424 KiB
5Accepted3/32ms2672 KiB
6Accepted3/32ms2780 KiB
7Accepted3/34ms4876 KiB
8Accepted3/34ms3976 KiB
9Accepted3/32ms2992 KiB
10Accepted3/32ms3016 KiB
11Accepted3/34ms5040 KiB
12Accepted3/34ms5288 KiB
13Accepted4/44ms5540 KiB
14Accepted4/44ms5572 KiB
15Accepted2/22ms3424 KiB
16Accepted2/22ms3432 KiB