#include <iostream> using namespace std; int main(int argc, char** argv) { int n; cin >> n; int cnt = 0; for (int a = 1; a <= n/7; ++a) { if (n % a != 0) continue; for (int b = 2*a; a+b <= n/2; b+=a) { if ((n - a) % b == 0) { ++cnt; } } } cout << cnt << endl; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | #include <iostream> using namespace std; int main(int argc, char** argv) { int n; cin >> n; int cnt = 0; for (int a = 1; a <= n/7; ++a) { if (n % a != 0) continue; for (int b = 2*a; a+b <= n/2; b+=a) { if ((n - a) % b == 0) { ++cnt; } } } cout << cnt << endl; return 0; } |