#include <bits/stdc++.h> #define lld long long int using namespace std; lld N,P,licz; int main() { scanf("%lld",&N); //P = (lld)pow( N, (double)1/3 ); for(lld i = 1;i<=N;++i) { lld pom = i*2; //cout << i << ": " << endl; while(pom<=N) { lld x = N-(i+pom); if(x<pom) { break; } if(x>pom and x%pom == 0) { ++licz; // cout << " DZIALA " << endl;f } pom+=i; } } printf("%lld",licz); }
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 | #include <bits/stdc++.h> #define lld long long int using namespace std; lld N,P,licz; int main() { scanf("%lld",&N); //P = (lld)pow( N, (double)1/3 ); for(lld i = 1;i<=N;++i) { lld pom = i*2; //cout << i << ": " << endl; while(pom<=N) { lld x = N-(i+pom); if(x<pom) { break; } if(x>pom and x%pom == 0) { ++licz; // cout << " DZIALA " << endl;f } pom+=i; } } printf("%lld",licz); } |