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~~~开心 弄了4次 终于写出0MS的拉!!!!

Posted by s2009zy at 2010-03-13 16:15:14 on Problem 1543
#include<iostream>
using namespace std;
int a[101]={0};

int main()
{
	int n;
	int i,j,k,l;;
	for(i=1;i<=100;i++)
	{
		a[i]=i*i*i;
	}
	scanf("%d",&n);
	for(i=6;i<=n;i++)
	{
		for(j=2;j<=n;j++)
		{
			for(k=j+1;k<=n;k++)
			{
				if((a[j]+a[k])>a[i])
					break;
				for(l=k+1;l<=n;l++)
				{
					if((a[j]+a[k]+a[l])>a[i])
						break;
					if(a[i]==a[j]+a[k]+a[l])
					{
						printf("Cube = %d, Triple = (%d,%d,%d)\n",i,j,k,l);
					}
				}
			}
		}
	}
}


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