#include <iostream> #include <math.h> int main(int argc , char** argv) { unsigned int n; std::cin >> n; int k,l,t; unsigned int counter = 0; for(int i=1; i<sqrt(n); i++) { if(n%i != 0) continue; t = n/i - 1; for(int j=2; j<sqrt(t); j++) { if(t%j == 0) { k = t/j - 1; if(i < j*i && j*i < j*i*k) { std::cerr << "(" << i << "," << j*i << "," << j*i*k << ")\n"; counter++; } l = t/j; k = j - 1; if(1 < l && i*l < l*k*i) { std::cerr << "(" << i << "," << l*i << "," << i*l*k << ")\n"; counter++; } } } } std::cout << counter<< "\n"; 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 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | #include <iostream> #include <math.h> int main(int argc , char** argv) { unsigned int n; std::cin >> n; int k,l,t; unsigned int counter = 0; for(int i=1; i<sqrt(n); i++) { if(n%i != 0) continue; t = n/i - 1; for(int j=2; j<sqrt(t); j++) { if(t%j == 0) { k = t/j - 1; if(i < j*i && j*i < j*i*k) { std::cerr << "(" << i << "," << j*i << "," << j*i*k << ")\n"; counter++; } l = t/j; k = j - 1; if(1 < l && i*l < l*k*i) { std::cerr << "(" << i << "," << l*i << "," << i*l*k << ")\n"; counter++; } } } } std::cout << counter<< "\n"; return 0; } |