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 Zeor at 2008-11-09 15:25:37 on Problem 1543
In Reply To:Re:请教非暴力,非打表的做法 Posted by:Hacker_QC at 2005-08-25 01:19:37
> #include <stdio.h>
> #include <math.h>
> int main() {
> 	int n,a,b,c,d,t;
> 	while( scanf("%d",&n)!=EOF ) {
> 		for( a=6; a<=n; ++a )
> 			for( b=2; b<=a; ++b )
> 				for( c=b; c<=a; ++c ) {
> 					if( b*b*b+c*c*c>=a*a*a ) continue;
> 					t=a*a*a-b*b*b-c*c*c;
> 					d=int(pow(t,1.0/3.0)+1e-5);
> 					if( d*d*d==t && d>=c ) printf("Cube = %d, Triple = (%d,%d,%d)\n",a,b,c,d);
> 				}
> 	}
> 	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