DP (rectangles perimetere (spoj) ,,,Sherlock and cost (hackerrank) ) -->> 2^n DP

1) DP prblm of 2^n type ,(rectangles perimetre http://www.spoj.com/problems/MMAXPER/) #include using namespace std; int main() { int n; cin>> n; int a[n],b[n],dp[n][2],i,j,k; for(i=0;i>a[i]>>b[i]; dp[0][0]=a[0], dp[0][1]=b[0]; for(i=1;i using namespace std; int dp[100002][2]; int a[100002]; int main() { int t; cin>>t; while(t--) { int n,i,j,k; cin>>n; dp[0][0]=0; dp[0][1]=0; for(i=0;i>a[i]; for(i=1;i

Comments

Popular posts from this blog

A. Dreamoon and Stairs : minimum steps to reach : recursion solution.

Getting Started With MEAN App Development with AngularJs , ExpressJs , NodeJs and MongoDB.

B. Dreamoon and WiFi :calculate no. of ways : recursive solution (branch and bound )