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 a,i,j,k,l,x1,x2,x3,x4; scanf("%d",&a); for(i=2;i<=a;i++) { x1=i*i*i; for(j=2;j<=i;j++) { x2=j*j*j; for(k=j+1;k<=i;k++) { x3=k*k*k; for(l=k+1;l<=i;l++) { x4=l*l*l; if(x2+x3+x4==x1) printf("Cube = %d, Triple = (%d,%d,%d)\n",i,j,k,l); } } } } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator