#include <iostream> int main() { int n, count = 0; std::cin >> n; for (int a = 1; a <= n / 3; a++) { for (int b = a*2, i = 3, c = n-a-b; b <= n / 3 && c>a && c>b; b *= i++) { if (c%a == 0 && c%b == 0 && b%a == 0) count++; } } std::cout << count << std::endl; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <iostream> int main() { int n, count = 0; std::cin >> n; for (int a = 1; a <= n / 3; a++) { for (int b = a*2, i = 3, c = n-a-b; b <= n / 3 && c>a && c>b; b *= i++) { if (c%a == 0 && c%b == 0 && b%a == 0) count++; } } std::cout << count << std::endl; return 0; } |