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

本来想这样做 超时了 所以一气之下

Posted by cpp050100448706 at 2005-03-25 09:59:14 on Problem 1543
In Reply To:最经典的做法 Posted by:cpp050100448706 at 2005-03-25 09:57:22
#include <iostream.h>
#include <math.h>

void main()
{
	int a;
	cin>>a;
	for(int i=2;i<=a;i++)
	{
		for(int j=2;j<i;j++)
			for(int k=j;k<i;k++)
				for(int h=k;h<i;h++)
					if(  (pow(h,3)+pow(j,3)+pow(k,3))== pow(i,3))
					cout<<"Cube = "<<i<<", Triple = ("<<j<<","<<k<<","<<h<<")"<<endl;
	}

}
					


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