37702023-03-02 21:36:05BttrngToronyépítés (80 pont)cpp17Accepted 80/8016ms18656 KiB
#include<bits/stdc++.h>
using namespace std;
vector<long long>cucc;

int main(){
  int n;
  cin>>n;
  cucc.resize(n+1);
  cucc[1]=3;
  cucc[2]=10;
  for(int i=3; i<=n; i++){
    cucc[i]=(cucc[i-1]*3+cucc[i-2])%20210108;
  }
  cout<<cucc[n]<<endl;
}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms1876 KiB
2Accepted0/03ms2100 KiB
3Accepted4/43ms2312 KiB
4Accepted4/43ms2552 KiB
5Accepted5/52ms2588 KiB
6Accepted5/53ms2724 KiB
7Accepted6/616ms18320 KiB
8Accepted6/64ms4800 KiB
9Accepted7/73ms3292 KiB
10Accepted7/73ms3260 KiB
11Accepted8/84ms6256 KiB
12Accepted8/816ms18656 KiB
13Accepted8/814ms17356 KiB
14Accepted8/87ms8868 KiB
15Accepted2/23ms3860 KiB
16Accepted2/22ms3872 KiB