120442024-11-26 13:05:56RRoliJárda-L (40)cpp17Wrong answer 4/401ms508 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, a[29][3];
	cin >> n;
	a[1][0] = 1; a[1][1] = 1; a[1][2] = 1; 
	a[2][0] = 2; a[1][1] = 1; a[1][2] = 1; 
	for(int i = 3; i <= n; i++) {
		a[i][0] = a[i-1][0] + a[i-2][0] + a[i-2][1] + a[i-2][2];
		a[i][1] = a[i-1][0] + a[i-1][2];
		a[i][2] = a[i-1][0] + a[i-1][1];
	}
	cout << a[n][0];
	return 0;
}
SubtaskSumTestVerdictTimeMemory
base4/40
1Accepted0/01ms320 KiB
2Wrong answer0/01ms320 KiB
3Accepted2/21ms508 KiB
4Accepted2/21ms320 KiB
5Wrong answer0/21ms320 KiB
6Wrong answer0/21ms320 KiB
7Wrong answer0/21ms500 KiB
8Wrong answer0/31ms320 KiB
9Wrong answer0/31ms320 KiB
10Wrong answer0/31ms320 KiB
11Wrong answer0/31ms320 KiB
12Wrong answer0/31ms320 KiB
13Wrong answer0/31ms320 KiB
14Wrong answer0/31ms320 KiB
15Wrong answer0/31ms320 KiB
16Wrong answer0/31ms320 KiB
17Wrong answer0/31ms320 KiB