Commit a7490079 authored by Michael's avatar Michael

michael.davityan:exercise_05_20v3

parent a101d8da
progname=exercise_05_20
CC=g++
CFLAGS=-Wall -Wextra -Werror -g3
all: test1
debug/$(progname): debug/$(progname).o
$(CC) $(CFLAGS) $< -o $@
debug/%.o: debug/%.s
$(CC) -c $(CFLAGS) $< -o $@
debug/%.s: debug/%.ii
$(CC) -S $(CFLAGS) $< -o $@
debug/%.ii: %.cpp | debug
$(CC) -E $(CFLAGS) $< -o $@
debug:
mkdir -p debug
clean:
rm -r debug Tests/*.out
test%: debug/$(progname)
@./debug/$(progname) < Tests/$@.in > Tests/$@.out 2>&1 || echo "$@ is executing..."
@diff Tests/$@.out Tests/$@.expected && echo PASSED || echo FAILED
.PRECIOUS: debug/%.ii debug/%.s
.SECONDARY: debug/%.ii debug/%.s
5, 3, 4
10, 6, 8
13, 5, 12
15, 9, 12
17, 8, 15
20, 12, 16
25, 7, 24
25, 15, 20
26, 10, 24
29, 20, 21
30, 18, 24
34, 16, 30
35, 21, 28
37, 12, 35
39, 15, 36
40, 24, 32
41, 9, 40
45, 27, 36
50, 14, 48
50, 30, 40
51, 24, 45
52, 20, 48
53, 28, 45
55, 33, 44
58, 40, 42
60, 36, 48
61, 11, 60
65, 16, 63
65, 25, 60
65, 33, 56
65, 39, 52
68, 32, 60
70, 42, 56
73, 48, 55
74, 24, 70
75, 21, 72
75, 45, 60
78, 30, 72
80, 48, 64
82, 18, 80
85, 13, 84
85, 36, 77
85, 40, 75
85, 51, 68
87, 60, 63
89, 39, 80
90, 54, 72
91, 35, 84
95, 57, 76
97, 65, 72
100, 28, 96
100, 60, 80
101, 20, 99
102, 48, 90
104, 40, 96
105, 63, 84
106, 56, 90
109, 60, 91
110, 66, 88
111, 36, 105
113, 15, 112
115, 69, 92
116, 80, 84
117, 45, 108
119, 56, 105
120, 72, 96
122, 22, 120
123, 27, 120
125, 35, 120
125, 44, 117
125, 75, 100
130, 32, 126
130, 50, 120
130, 66, 112
130, 78, 104
135, 81, 108
136, 64, 120
137, 88, 105
140, 84, 112
143, 55, 132
145, 17, 144
145, 24, 143
145, 87, 116
145, 100, 105
146, 96, 110
148, 48, 140
149, 51, 140
150, 42, 144
150, 90, 120
153, 72, 135
155, 93, 124
156, 60, 144
157, 85, 132
159, 84, 135
160, 96, 128
164, 36, 160
165, 99, 132
169, 65, 156
169, 119, 120
170, 26, 168
170, 72, 154
170, 80, 150
170, 102, 136
173, 52, 165
174, 120, 126
175, 49, 168
175, 105, 140
178, 78, 160
180, 108, 144
181, 19, 180
182, 70, 168
183, 33, 180
185, 57, 176
185, 60, 175
185, 104, 153
185, 111, 148
187, 88, 165
190, 114, 152
193, 95, 168
194, 130, 144
195, 48, 189
195, 75, 180
195, 99, 168
195, 117, 156
197, 28, 195
200, 56, 192
200, 120, 160
202, 40, 198
203, 140, 147
204, 96, 180
205, 45, 200
205, 84, 187
205, 123, 164
205, 133, 156
208, 80, 192
210, 126, 168
212, 112, 180
215, 129, 172
218, 120, 182
219, 144, 165
220, 132, 176
221, 21, 220
221, 85, 204
221, 104, 195
221, 140, 171
222, 72, 210
225, 63, 216
225, 135, 180
226, 30, 224
229, 60, 221
230, 138, 184
232, 160, 168
233, 105, 208
234, 90, 216
235, 141, 188
238, 112, 210
240, 144, 192
241, 120, 209
244, 44, 240
245, 147, 196
246, 54, 240
247, 95, 228
250, 70, 240
250, 88, 234
250, 150, 200
255, 39, 252
255, 108, 231
255, 120, 225
255, 153, 204
257, 32, 255
259, 84, 245
260, 64, 252
260, 100, 240
260, 132, 224
260, 156, 208
261, 180, 189
265, 23, 264
265, 96, 247
265, 140, 225
265, 159, 212
267, 117, 240
269, 69, 260
270, 162, 216
272, 128, 240
273, 105, 252
274, 176, 210
275, 77, 264
275, 165, 220
277, 115, 252
280, 168, 224
281, 160, 231
285, 171, 228
286, 110, 264
287, 63, 280
289, 136, 255
289, 161, 240
290, 34, 288
290, 48, 286
290, 174, 232
290, 200, 210
291, 195, 216
292, 192, 220
293, 68, 285
295, 177, 236
296, 96, 280
298, 102, 280
299, 115, 276
300, 84, 288
300, 180, 240
303, 60, 297
305, 55, 300
305, 136, 273
305, 183, 244
305, 207, 224
306, 144, 270
310, 186, 248
312, 120, 288
313, 25, 312
314, 170, 264
315, 189, 252
317, 75, 308
318, 168, 270
319, 220, 231
320, 192, 256
323, 152, 285
325, 36, 323
325, 80, 315
325, 91, 312
325, 125, 300
325, 165, 280
325, 195, 260
325, 204, 253
327, 180, 273
328, 72, 320
330, 198, 264
333, 108, 315
335, 201, 268
337, 175, 288
338, 130, 312
338, 238, 240
339, 45, 336
340, 52, 336
340, 144, 308
340, 160, 300
340, 204, 272
345, 207, 276
346, 104, 330
348, 240, 252
349, 180, 299
350, 98, 336
350, 210, 280
351, 135, 324
353, 225, 272
355, 213, 284
356, 156, 320
357, 168, 315
360, 216, 288
362, 38, 360
364, 140, 336
365, 27, 364
365, 76, 357
365, 219, 292
365, 240, 275
366, 66, 360
369, 81, 360
370, 114, 352
370, 120, 350
370, 208, 306
370, 222, 296
371, 196, 315
373, 252, 275
374, 176, 330
375, 105, 360
375, 132, 351
375, 225, 300
377, 135, 352
377, 145, 348
377, 152, 345
377, 260, 273
380, 228, 304
385, 231, 308
386, 190, 336
388, 260, 288
389, 189, 340
390, 96, 378
390, 150, 360
390, 198, 336
390, 234, 312
391, 184, 345
394, 56, 390
395, 237, 316
397, 228, 325
400, 112, 384
400, 240, 320
401, 40, 399
403, 155, 372
404, 80, 396
405, 243, 324
406, 280, 294
407, 132, 385
408, 192, 360
409, 120, 391
410, 90, 400
410, 168, 374
410, 246, 328
410, 266, 312
411, 264, 315
415, 249, 332
416, 160, 384
420, 252, 336
421, 29, 420
424, 224, 360
425, 65, 420
425, 87, 416
425, 119, 408
425, 180, 385
425, 200, 375
425, 255, 340
425, 297, 304
427, 77, 420
429, 165, 396
430, 258, 344
433, 145, 408
435, 51, 432
435, 72, 429
435, 261, 348
435, 300, 315
436, 240, 364
438, 288, 330
440, 264, 352
442, 42, 440
442, 170, 408
442, 208, 390
442, 280, 342
444, 144, 420
445, 84, 437
445, 195, 400
445, 203, 396
445, 267, 356
447, 153, 420
449, 280, 351
450, 126, 432
450, 270, 360
451, 99, 440
452, 60, 448
455, 112, 441
455, 175, 420
455, 231, 392
455, 273, 364
457, 168, 425
458, 120, 442
459, 216, 405
460, 276, 368
461, 261, 380
464, 320, 336
465, 279, 372
466, 210, 416
468, 180, 432
470, 282, 376
471, 255, 396
475, 133, 456
475, 285, 380
476, 224, 420
477, 252, 405
480, 288, 384
481, 31, 480
481, 156, 455
481, 185, 444
481, 319, 360
482, 240, 418
485, 44, 483
485, 93, 476
485, 291, 388
485, 325, 360
488, 88, 480
490, 294, 392
492, 108, 480
493, 132, 475
493, 155, 468
493, 232, 435
493, 340, 357
494, 190, 456
495, 297, 396
500, 140, 480
500, 176, 468
500, 300, 400
#include <iostream>
int
main()
{
for (int hypotenuse = 1; hypotenuse <= 500; ++hypotenuse) {
for (int catheter1 = 1; catheter1 <= 340; ++catheter1) {
for (int catheter2 = catheter1; catheter2 <= 483; ++catheter2) {
if (hypotenuse * hypotenuse == catheter1 * catheter1 + catheter2 * catheter2) {
std::cout << hypotenuse << ", " << catheter1 << ", " << catheter2 << std::endl;
}
}
}
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment