-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathperfectCubesOJ.cpp
41 lines (36 loc) · 938 Bytes
/
perfectCubesOJ.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <set>
#include <string>
#include <vector>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
for (int a = 6; a <= 200; ++a)
{
for (int b = 2; b <= a; ++b)
{
for (int c = b; a * a * a - c * c * c - b * b * b > c * c * c; ++c)
{
double cubeD = a * a * a - b * b * b - c * c * c;
for (int i = 1; i <= 200; ++i)
{
if (i * i * i == cubeD)
{
cout << "Cube = " << a << ", Triple = (" << b << ',' << c << ',' << i << ")\n";
break;
}
}
}
}
}
cout.flush();
return 0;
}