#include <iostream> using namespace std; int main() { int n; cin >> n; int cnt = 0; // m stands for multiplier for (int m1 = 2; m1 <= n / 3; ++m1) { for (int m2 = 2; m2 <= (n-m1-1) / m1; ++m2) { if (n % (1 + m1 + m1 * m2) == 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 20 21 22 23 24 | #include <iostream> using namespace std; int main() { int n; cin >> n; int cnt = 0; // m stands for multiplier for (int m1 = 2; m1 <= n / 3; ++m1) { for (int m2 = 2; m2 <= (n-m1-1) / m1; ++m2) { if (n % (1 + m1 + m1 * m2) == 0) { ++cnt; } } } cout << cnt<<endl; return 0; } |