#include <iostream> using namespace std; int main() { int sum; int numOfPass = 0; std::cin >> sum; int result; // for(int a=1; a<142857142; ++a) { int aMax = (sum / 7) + 1; for(int a=1; a<aMax; ++a) { if(sum % a == 0) { int newSum = (sum / a) - 1; int kMax = (newSum / 3) + 1; for(int k=2; k<kMax; ++k) { if(newSum % k == 0) { int m = (newSum / k) - 1; if(m >= 2) { ++numOfPass; } } } } } std::cout << numOfPass << '\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 | #include <iostream> using namespace std; int main() { int sum; int numOfPass = 0; std::cin >> sum; int result; // for(int a=1; a<142857142; ++a) { int aMax = (sum / 7) + 1; for(int a=1; a<aMax; ++a) { if(sum % a == 0) { int newSum = (sum / a) - 1; int kMax = (newSum / 3) + 1; for(int k=2; k<kMax; ++k) { if(newSum % k == 0) { int m = (newSum / k) - 1; if(m >= 2) { ++numOfPass; } } } } } std::cout << numOfPass << '\n'; return 0; } |