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

各位牛人,有谁有更好的方法你们的怎么是0MS呢? 我的是这样的,希望找到更好的方法!谢谢!

Posted by wuqianhu12 at 2006-12-07 21:15:10 on Problem 1543
#include <stdio.h>
#include <stdlib.h>

int main () 
{
	int M,N,i,j,k,x,m,n,t,Cube,Ttiple;

	scanf("%d",&N);
	
      if(N>1&&N<=100)
	{
		for(x=2;x<=N;x++)
		{
			M=x*x*x;
		for(i=2;i<=N;i++)
		{
			m=i*i*i;
		for(j=2;j<=N;j++)
		{
			n=j*j*j;
		for(k=2;k<=N;k++)
		{
			t=k*k*k;
		if(m+n+t==M)
			if(i<=j&&j<=k)
			printf("Cube = %d, Triple = (%d,%d,%d)\n", x,i,j,k);
		}
		}
		}
		}
			
	}
}

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