Niestety, nie byliśmy w stanie w pełni poprawnie wyświetlić tego pliku, ponieważ nie jest zakodowany w UTF-8. Możesz pobrać ten plik i spróbować otworzyć go samodzielnie.
 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
#include <iostream>
#include <cmath>

int findTriples(int n) {
    int count = 0;

    for (int a = 1; a <= n; ++a) {
        for (int b = a; b <= n; ++b) { // b >= a, aby unikn�� duplikat�w {a, b}
            int maxH = std::sqrt(n * n - a * a - b * b); // Maksymalny h, kt�ry spe�nia warunek
            for (int h = 1; h <= maxH; ++h) {
                int sumSquares = a * a + b * b + h * h;
                int sqrtValue = static_cast<int>(std::sqrt(sumSquares));
                if (sqrtValue * sqrtValue == sumSquares && sqrtValue <= n) { // Sprawdzenie ca�kowitego pierwiastka
                   /* std::cout << "(a, b, h) = (" << a << ", " << b << ", " << h << ") => sqrt("
                        << sumSquares << ") = " << sqrtValue << std::endl;*/
                    count++;
                }
            }
        }
    }

    /*std::cout << "Liczba unikalnych trojek (a, b, h), dla ktorych sqrt(a^2 + b^2 + h^2) jest liczba calkowita i <= n: "
        << count << std::endl;*/
    return count;
}

int main() {
    int n;
    //std::cout << "Podaj liczbe n: ";
    std::cin >> n;
    std::cout<<findTriples(n);
    return 0;
}