#include <cstdlib> #include <cstdio> int main(int argc, char **argv) { int n = 0; scanf("%d", &n); int count = 0; for (int a = 1; a <= n / 6; a++) { int b = 2 * a; int c = n - a - b; while (b < c) { if ((c % b) == 0) { count++; } b = b + a; c = n - a - b; } } printf("%d", count); return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #include <cstdlib> #include <cstdio> int main(int argc, char **argv) { int n = 0; scanf("%d", &n); int count = 0; for (int a = 1; a <= n / 6; a++) { int b = 2 * a; int c = n - a - b; while (b < c) { if ((c % b) == 0) { count++; } b = b + a; c = n - a - b; } } printf("%d", count); return 0; } |