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

为什么呢?wa!求指点!

Posted by jean890915 at 2011-10-06 15:22:35 on Problem 1000
#include "iostream"
#include "math.h"
using namespace std;

int main()
{
	int i,j,k,n,max=1000000000;
	int max_i,max_j,max_k;
	cin>>n;

	for (i=1;i<=n/2;i++)
	{
		if (n%i==0)
		{
			for (j=1;j<=n/i;j++)
			{
				k = i*j;
				if (n%k == 0)
				{
					{
						k = n/k;
						if (2*(i*j+j*k+k*i)<max)
						{
							max = 2*(i*j+j*k+k*i);
							max_i = i;
							max_j = j;
							max_k = k;
						}
					}
				}
			}
		}
	}
	cout<<max_i<<" "<<max_j<<" "<<max_k<<"\n";
	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