36712023-03-02 10:29:23JMMirkoToronyépítés (80 pont)cpp17Accepted 80/8030ms18784 KiB
#include <bits/stdc++.h>
using namespace std;
int mod=20210108;
int main() {
	int n;
	cin >> n;
	vector<long long>v(n);
	v[0]=3;
	v[1]=10;
	for(int i=2;i<n;i++){
		v[i]=(v[i-1]*3+v[i-2])%mod;
	}
	cout << v[n-1];
}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms1680 KiB
2Accepted0/03ms1860 KiB
3Accepted4/42ms2056 KiB
4Accepted4/42ms2272 KiB
5Accepted5/52ms2480 KiB
6Accepted5/52ms2696 KiB
7Accepted6/630ms18428 KiB
8Accepted6/66ms4996 KiB
9Accepted7/72ms3272 KiB
10Accepted7/73ms3268 KiB
11Accepted8/88ms6564 KiB
12Accepted8/829ms18784 KiB
13Accepted8/827ms17292 KiB
14Accepted8/812ms8744 KiB
15Accepted2/22ms3696 KiB
16Accepted2/22ms3804 KiB