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

暴力!!! 32ms!!!

Posted by 810974380 at 2009-07-29 20:00:30 on Problem 1543

#include<iostream>
using namespace std;
int fun(int n)
{ return n*n*n; }
int main()
{ int a,m[120];int i,j,k,l;
  for(int w=1;w<=110;w++)
	  m[w]=fun(w);
  cin>>a;
  for(i=2;i<=a;i++)
  { for(j=2;j<=a;j++)
       for(k=j+1;k<=a;k++)
		   for(l=k+1;l<=a;l++)
			   if((m[i])==(m[j]+m[k]+m[l])) 
				   cout<<"Cube = "<<i<<','<<" Triple = ("<<j<<','<<k<<','<<l<<')'<<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