Problem | Verdict | Lang | Time | Best | Rank | Submit Time |
---|---|---|---|---|---|---|
| discuss386 - | Accepted | C++11 | 0.060 | 0.000 | 1699 | 1 mins ago |
#include<bits/stdc++.h>
#define eps 1e-9
#define X first
#define Y second
using namespace std;
typedef pair<int, int> ii;
typedef pair<ii, ii> iii;
int f(int x){
return x*x*x;
}
double ff(int x){
return pow(x, 1.0 / 3.0);
}
int main(){
ios::sync_with_stdio(false); cin.tie(nullptr);
multiset<iii> cubes;
for(int b=2; b<=200; b++)
for(int c=b+1; c<=200; c++)
for(int d=c+1; d<=200; d++){
int fa= f(b) + f(c) + f(d);
if (fa>f(200)) break;
int a= round(ff(fa));
if (abs(ff(fa)-a)<eps) cubes.insert(iii(ii(a,b), ii(c,d)));
}
for(auto v:cubes)
cout<<"Cube = "<<v.X.X<<", Triple = ("<<v.X.Y<<","<<v.Y.X<<","<<v.Y.Y<<")\n";
}
No comments:
Post a Comment