View Code of Problem 3834

#include<bits/stdc++.h>
using namespace std;
int dp(int n){
	if(n==2){
		return 5;
	}
	else if(n==1){
		return 2;
	}
	else if(n>2){
		return dp(n-1)*3-1;
	}
}
int main(){
	int n;
	cin>>n;
	cout<<dp(n)<<endl;
}
/*
Main.c:1:9: fatal error: bits/stdc++.h: No such file or directory
 #include<bits/stdc++.h>
         ^~~~~~~~~~~~~~~
compilation terminated.
*/

Double click to view unformatted code.


Back to problem 3834