Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

必须ac(openjudge题解常客)

Posted by 080528lj at 2021-08-25 19:01:24 on Problem 1958
#include<iostream>
#include<cstring>
using namespace std;
const int N=13;
int Hanoi_three[N];
int Hanoi_four[N];

int main()
{
	memset(Hanoi_four,0x3f,sizeof Hanoi_four);
	Hanoi_four[1]=1;
	for(int n=2;n<=12;n++)
	{
		for(int i=1;i<=n;i++)
		{
			Hanoi_three[n]=2*Hanoi_four[n-i]+(1<<i)-1;
			Hanoi_four[n]=min(Hanoi_four[n],Hanoi_three[n]);
		}
	}
	for(int i=1;i<=12;i++)
	{
		cout<<Hanoi_four[i]<<endl;
	}
	return 0;
}


Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator