| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
是从二开始的暴力的!看清楚#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator