-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathUVA00386.cpp
249 lines (247 loc) · 9.42 KB
/
UVA00386.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
#include <iostream>
#include <cmath>
using namespace std;
int main2() {
for (int a = 1; a <= 200; a++) {
for (int b = 2; b <= 200; b++) {
if (b >= a) break;
int a3 = a*a*a, b3 = b*b*b;
int val = a3 - b3;
for (int c = b + 1; c <= 200; c++) {
int c3 = c*c*c;
int d = val - c3;
d = floor(cbrt(d));
if (c > d) break;
int d3 = d*d*d;
if (a3 == b3 + c3 + d3) printf("Cube = %d, Triple = (%d,%d,%d)\n", a, b, c, d);
}
}
}
return 0;
}
int main() {
printf("Cube = 6, Triple = (3,4,5)\n"
"Cube = 12, Triple = (6,8,10)\n"
"Cube = 18, Triple = (2,12,16)\n"
"Cube = 18, Triple = (9,12,15)\n"
"Cube = 19, Triple = (3,10,18)\n"
"Cube = 20, Triple = (7,14,17)\n"
"Cube = 24, Triple = (12,16,20)\n"
"Cube = 25, Triple = (4,17,22)\n"
"Cube = 27, Triple = (3,18,24)\n"
"Cube = 28, Triple = (18,19,21)\n"
"Cube = 29, Triple = (11,15,27)\n"
"Cube = 30, Triple = (15,20,25)\n"
"Cube = 36, Triple = (4,24,32)\n"
"Cube = 36, Triple = (18,24,30)\n"
"Cube = 38, Triple = (6,20,36)\n"
"Cube = 40, Triple = (14,28,34)\n"
"Cube = 41, Triple = (2,17,40)\n"
"Cube = 41, Triple = (6,32,33)\n"
"Cube = 42, Triple = (21,28,35)\n"
"Cube = 44, Triple = (16,23,41)\n"
"Cube = 45, Triple = (5,30,40)\n"
"Cube = 46, Triple = (3,36,37)\n"
"Cube = 46, Triple = (27,30,37)\n"
"Cube = 48, Triple = (24,32,40)\n"
"Cube = 50, Triple = (8,34,44)\n"
"Cube = 53, Triple = (29,34,44)\n"
"Cube = 54, Triple = (6,36,48)\n"
"Cube = 54, Triple = (12,19,53)\n"
"Cube = 54, Triple = (27,36,45)\n"
"Cube = 56, Triple = (36,38,42)\n"
"Cube = 57, Triple = (9,30,54)\n"
"Cube = 58, Triple = (15,42,49)\n"
"Cube = 58, Triple = (22,30,54)\n"
"Cube = 60, Triple = (21,42,51)\n"
"Cube = 60, Triple = (30,40,50)\n"
"Cube = 63, Triple = (7,42,56)\n"
"Cube = 66, Triple = (33,44,55)\n"
"Cube = 67, Triple = (22,51,54)\n"
"Cube = 69, Triple = (36,38,61)\n"
"Cube = 70, Triple = (7,54,57)\n"
"Cube = 71, Triple = (14,23,70)\n"
"Cube = 72, Triple = (8,48,64)\n"
"Cube = 72, Triple = (34,39,65)\n"
"Cube = 72, Triple = (36,48,60)\n"
"Cube = 75, Triple = (12,51,66)\n"
"Cube = 75, Triple = (38,43,66)\n"
"Cube = 76, Triple = (12,40,72)\n"
"Cube = 76, Triple = (31,33,72)\n"
"Cube = 78, Triple = (39,52,65)\n"
"Cube = 80, Triple = (28,56,68)\n"
"Cube = 81, Triple = (9,54,72)\n"
"Cube = 81, Triple = (25,48,74)\n"
"Cube = 82, Triple = (4,34,80)\n"
"Cube = 82, Triple = (12,64,66)\n"
"Cube = 82, Triple = (19,60,69)\n"
"Cube = 84, Triple = (28,53,75)\n"
"Cube = 84, Triple = (42,56,70)\n"
"Cube = 84, Triple = (54,57,63)\n"
"Cube = 85, Triple = (50,61,64)\n"
"Cube = 87, Triple = (20,54,79)\n"
"Cube = 87, Triple = (26,55,78)\n"
"Cube = 87, Triple = (33,45,81)\n"
"Cube = 87, Triple = (38,48,79)\n"
"Cube = 88, Triple = (21,43,84)\n"
"Cube = 88, Triple = (25,31,86)\n"
"Cube = 88, Triple = (32,46,82)\n"
"Cube = 89, Triple = (17,40,86)\n"
"Cube = 90, Triple = (10,60,80)\n"
"Cube = 90, Triple = (25,38,87)\n"
"Cube = 90, Triple = (45,60,75)\n"
"Cube = 90, Triple = (58,59,69)\n"
"Cube = 92, Triple = (6,72,74)\n"
"Cube = 92, Triple = (54,60,74)\n"
"Cube = 93, Triple = (32,54,85)\n"
"Cube = 95, Triple = (15,50,90)\n"
"Cube = 96, Triple = (19,53,90)\n"
"Cube = 96, Triple = (48,64,80)\n"
"Cube = 97, Triple = (45,69,79)\n"
"Cube = 99, Triple = (11,66,88)\n"
"Cube = 100, Triple = (16,68,88)\n"
"Cube = 100, Triple = (35,70,85)\n"
"Cube = 102, Triple = (51,68,85)\n"
"Cube = 103, Triple = (12,31,102)\n"
"Cube = 105, Triple = (33,70,92)\n"
"Cube = 106, Triple = (58,68,88)\n"
"Cube = 108, Triple = (12,72,96)\n"
"Cube = 108, Triple = (13,51,104)\n"
"Cube = 108, Triple = (15,82,89)\n"
"Cube = 108, Triple = (24,38,106)\n"
"Cube = 108, Triple = (54,72,90)\n"
"Cube = 110, Triple = (29,75,96)\n"
"Cube = 111, Triple = (16,47,108)\n"
"Cube = 112, Triple = (72,76,84)\n"
"Cube = 113, Triple = (50,74,97)\n"
"Cube = 114, Triple = (18,60,108)\n"
"Cube = 114, Triple = (57,76,95)\n"
"Cube = 115, Triple = (3,34,114)\n"
"Cube = 116, Triple = (23,86,97)\n"
"Cube = 116, Triple = (30,84,98)\n"
"Cube = 116, Triple = (44,60,108)\n"
"Cube = 117, Triple = (13,78,104)\n"
"Cube = 120, Triple = (9,55,116)\n"
"Cube = 120, Triple = (42,84,102)\n"
"Cube = 120, Triple = (60,80,100)\n"
"Cube = 121, Triple = (49,84,102)\n"
"Cube = 122, Triple = (19,92,101)\n"
"Cube = 123, Triple = (6,51,120)\n"
"Cube = 123, Triple = (18,96,99)\n"
"Cube = 123, Triple = (44,51,118)\n"
"Cube = 125, Triple = (20,85,110)\n"
"Cube = 126, Triple = (14,84,112)\n"
"Cube = 126, Triple = (23,94,105)\n"
"Cube = 126, Triple = (63,84,105)\n"
"Cube = 127, Triple = (13,65,121)\n"
"Cube = 129, Triple = (38,57,124)\n"
"Cube = 132, Triple = (5,76,123)\n"
"Cube = 132, Triple = (48,69,123)\n"
"Cube = 132, Triple = (66,88,110)\n"
"Cube = 133, Triple = (21,70,126)\n"
"Cube = 134, Triple = (44,102,108)\n"
"Cube = 134, Triple = (86,95,97)\n"
"Cube = 135, Triple = (15,90,120)\n"
"Cube = 137, Triple = (44,73,128)\n"
"Cube = 138, Triple = (9,108,111)\n"
"Cube = 138, Triple = (69,92,115)\n"
"Cube = 138, Triple = (72,76,122)\n"
"Cube = 138, Triple = (81,90,111)\n"
"Cube = 139, Triple = (94,96,99)\n"
"Cube = 140, Triple = (14,108,114)\n"
"Cube = 140, Triple = (49,98,119)\n"
"Cube = 140, Triple = (90,95,105)\n"
"Cube = 141, Triple = (72,85,122)\n"
"Cube = 142, Triple = (28,46,140)\n"
"Cube = 142, Triple = (31,64,137)\n"
"Cube = 144, Triple = (16,96,128)\n"
"Cube = 144, Triple = (68,78,130)\n"
"Cube = 144, Triple = (72,96,120)\n"
"Cube = 145, Triple = (12,81,136)\n"
"Cube = 145, Triple = (55,75,135)\n"
"Cube = 147, Triple = (22,75,140)\n"
"Cube = 150, Triple = (24,102,132)\n"
"Cube = 150, Triple = (71,73,138)\n"
"Cube = 150, Triple = (75,100,125)\n"
"Cube = 150, Triple = (76,86,132)\n"
"Cube = 151, Triple = (46,47,148)\n"
"Cube = 152, Triple = (24,80,144)\n"
"Cube = 152, Triple = (62,66,144)\n"
"Cube = 153, Triple = (17,102,136)\n"
"Cube = 156, Triple = (65,87,142)\n"
"Cube = 156, Triple = (78,104,130)\n"
"Cube = 159, Triple = (3,121,131)\n"
"Cube = 159, Triple = (87,102,132)\n"
"Cube = 160, Triple = (56,112,136)\n"
"Cube = 160, Triple = (69,123,124)\n"
"Cube = 162, Triple = (18,108,144)\n"
"Cube = 162, Triple = (36,57,159)\n"
"Cube = 162, Triple = (50,96,148)\n"
"Cube = 162, Triple = (59,93,148)\n"
"Cube = 162, Triple = (81,108,135)\n"
"Cube = 164, Triple = (8,68,160)\n"
"Cube = 164, Triple = (24,128,132)\n"
"Cube = 164, Triple = (38,120,138)\n"
"Cube = 164, Triple = (69,99,146)\n"
"Cube = 167, Triple = (12,86,159)\n"
"Cube = 168, Triple = (56,106,150)\n"
"Cube = 168, Triple = (84,112,140)\n"
"Cube = 168, Triple = (108,114,126)\n"
"Cube = 170, Triple = (96,107,141)\n"
"Cube = 170, Triple = (100,122,128)\n"
"Cube = 171, Triple = (19,114,152)\n"
"Cube = 171, Triple = (27,90,162)\n"
"Cube = 171, Triple = (54,80,163)\n"
"Cube = 171, Triple = (107,108,136)\n"
"Cube = 174, Triple = (40,108,158)\n"
"Cube = 174, Triple = (45,126,147)\n"
"Cube = 174, Triple = (47,97,162)\n"
"Cube = 174, Triple = (52,110,156)\n"
"Cube = 174, Triple = (66,90,162)\n"
"Cube = 174, Triple = (76,96,158)\n"
"Cube = 174, Triple = (87,116,145)\n"
"Cube = 175, Triple = (28,119,154)\n"
"Cube = 176, Triple = (25,92,167)\n"
"Cube = 176, Triple = (42,86,168)\n"
"Cube = 176, Triple = (50,62,172)\n"
"Cube = 176, Triple = (64,92,164)\n"
"Cube = 177, Triple = (48,137,142)\n"
"Cube = 178, Triple = (34,80,172)\n"
"Cube = 178, Triple = (48,133,147)\n"
"Cube = 179, Triple = (17,57,177)\n"
"Cube = 180, Triple = (20,120,160)\n"
"Cube = 180, Triple = (50,76,174)\n"
"Cube = 180, Triple = (63,126,153)\n"
"Cube = 180, Triple = (90,120,150)\n"
"Cube = 180, Triple = (116,118,138)\n"
"Cube = 181, Triple = (108,109,150)\n"
"Cube = 184, Triple = (12,144,148)\n"
"Cube = 184, Triple = (108,120,148)\n"
"Cube = 185, Triple = (57,68,180)\n"
"Cube = 185, Triple = (68,113,166)\n"
"Cube = 186, Triple = (18,121,167)\n"
"Cube = 186, Triple = (64,108,170)\n"
"Cube = 186, Triple = (93,124,155)\n"
"Cube = 187, Triple = (58,131,160)\n"
"Cube = 188, Triple = (115,122,149)\n"
"Cube = 189, Triple = (21,46,188)\n"
"Cube = 189, Triple = (21,126,168)\n"
"Cube = 190, Triple = (30,100,180)\n"
"Cube = 190, Triple = (56,133,163)\n"
"Cube = 191, Triple = (39,146,156)\n"
"Cube = 192, Triple = (34,123,173)\n"
"Cube = 192, Triple = (38,106,180)\n"
"Cube = 192, Triple = (96,128,160)\n"
"Cube = 193, Triple = (25,68,190)\n"
"Cube = 194, Triple = (90,138,158)\n"
"Cube = 196, Triple = (126,133,147)\n"
"Cube = 197, Triple = (53,58,194)\n"
"Cube = 198, Triple = (22,132,176)\n"
"Cube = 198, Triple = (27,46,197)\n"
"Cube = 198, Triple = (73,135,170)\n"
"Cube = 198, Triple = (99,132,165)\n"
"Cube = 199, Triple = (6,127,180)\n"
"Cube = 200, Triple = (32,136,176)\n"
"Cube = 200, Triple = (70,140,170)\n");
return 0;
}