#include<iostream> //#include<windows.h> #include<algorithm> #include<cmath> #include<vector> #include<set> #include<map> #include<iomanip> #include<stack> #include<queue> #include<string> #include<cstring> #include<cstdlib> #include<ctime> #include<bitset> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> ii; typedef vector< ii > vii; typedef vector< pair < ii, int > > viii; typedef vector< vector < ii > > vvii; typedef pair < pair < int, int >, int > iii; typedef pair < pair < int, int >, pair < int, int > > iiii; typedef unsigned long long ull; typedef long long ll; typedef unsigned long long ull; typedef vector< ll > vll; typedef long double ld; typedef map < int, int > MAPA; #define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define sz(a) int((a).size()) #define pb push_back #define all(c) (c).begin(), (c).end() #define st first #define nd second #define rep(i,n) for(int i=0; i<(n); ++i) #define rall(c) (c).rbegin(), (c).rend() #define FOR(i, a, b) for (int (i)=(a); (i)<(b); (i)++) #define FOR2(i, a, b) for (int (i)=(a); (i)>=(b); (i)--) template<typename T> inline void setmin(T &x, T y) { if (y < x) x = y; } template<typename T> inline void setmax(T &x, T y) { if (y > x) x = y; } template<typename T> inline T gcd(T a, T b) { while (b)swap(a %= b, b); return a; } const int MAX = 1e5 + 7; const int T = 1 << 18; const int INF = 1e9 + 7; const ll BIG_INF = 1e18 + 5; ld e = 2.7182818284590452353602874713526624; ld PI = acos(-1); ld eps = 1e-19; ll n; ll res; void sprawdz(int pier) { int nowa = n - pier; for (int i = 2; i <= sqrt(nowa/pier) ; i++ ) { if (nowa % i == 0) { if (i * 2 != nowa/pier) { res++; } } } } int main(){ boost; cin >> n; for (int i = 1; i <= sqrt(n); i++) { if (n % i == 0) { sprawdz(i); if (i * i != n) { sprawdz(n / i); } } } cout << res; } /* */
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 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | #include<iostream> //#include<windows.h> #include<algorithm> #include<cmath> #include<vector> #include<set> #include<map> #include<iomanip> #include<stack> #include<queue> #include<string> #include<cstring> #include<cstdlib> #include<ctime> #include<bitset> using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> ii; typedef vector< ii > vii; typedef vector< pair < ii, int > > viii; typedef vector< vector < ii > > vvii; typedef pair < pair < int, int >, int > iii; typedef pair < pair < int, int >, pair < int, int > > iiii; typedef unsigned long long ull; typedef long long ll; typedef unsigned long long ull; typedef vector< ll > vll; typedef long double ld; typedef map < int, int > MAPA; #define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define sz(a) int((a).size()) #define pb push_back #define all(c) (c).begin(), (c).end() #define st first #define nd second #define rep(i,n) for(int i=0; i<(n); ++i) #define rall(c) (c).rbegin(), (c).rend() #define FOR(i, a, b) for (int (i)=(a); (i)<(b); (i)++) #define FOR2(i, a, b) for (int (i)=(a); (i)>=(b); (i)--) template<typename T> inline void setmin(T &x, T y) { if (y < x) x = y; } template<typename T> inline void setmax(T &x, T y) { if (y > x) x = y; } template<typename T> inline T gcd(T a, T b) { while (b)swap(a %= b, b); return a; } const int MAX = 1e5 + 7; const int T = 1 << 18; const int INF = 1e9 + 7; const ll BIG_INF = 1e18 + 5; ld e = 2.7182818284590452353602874713526624; ld PI = acos(-1); ld eps = 1e-19; ll n; ll res; void sprawdz(int pier) { int nowa = n - pier; for (int i = 2; i <= sqrt(nowa/pier) ; i++ ) { if (nowa % i == 0) { if (i * 2 != nowa/pier) { res++; } } } } int main(){ boost; cin >> n; for (int i = 1; i <= sqrt(n); i++) { if (n % i == 0) { sprawdz(i); if (i * i != n) { sprawdz(n / i); } } } cout << res; } /* */ |