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 |
暴力!!! 32ms!!!#include<iostream> using namespace std; int fun(int n) { return n*n*n; } int main() { int a,m[120];int i,j,k,l; for(int w=1;w<=110;w++) m[w]=fun(w); cin>>a; for(i=2;i<=a;i++) { for(j=2;j<=a;j++) for(k=j+1;k<=a;k++) for(l=k+1;l<=a;l++) if((m[i])==(m[j]+m[k]+m[l])) cout<<"Cube = "<<i<<','<<" Triple = ("<<j<<','<<k<<','<<l<<')'<<endl; } return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator