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 |
本来想这样做 超时了 所以一气之下In Reply To:最经典的做法 Posted by:cpp050100448706 at 2005-03-25 09:57:22 #include <iostream.h> #include <math.h> void main() { int a; cin>>a; for(int i=2;i<=a;i++) { for(int j=2;j<i;j++) for(int k=j;k<i;k++) for(int h=k;h<i;h++) if( (pow(h,3)+pow(j,3)+pow(k,3))== pow(i,3)) cout<<"Cube = "<<i<<", Triple = ("<<j<<","<<k<<","<<h<<")"<<endl; } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator