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 chenxuan123456789 at 2012-07-29 08:44:04 on Problem 1543
#include "stdio.h"
int main()
{
    int n,a,b,c,d;
    scanf("%d",&n);
    for(d=1;d<=n;d++)
    {
      for(a=2;a<=d;a++)
      {
       for(b=a+1;b<=d;b++)
       {
        for(c=b+1;c<=d;c++)
        if(d*d*d==a*a*a+b*b*b+c*c*c)
        printf("Cube = %d, Triple = (%d,%d,%d)\n",d,a,b,c);
        }
        }
        }
        return 1;
        }

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