/*{{{*/ #include <bits/stdc++.h> #ifdef LOCAL int c_; #define cout (c_?cerr:cout) #define debug(...) {cerr<<(!c_?"\033[96;1m":"");\ ++c_;__VA_ARGS__;--c_;cerr<<(!c_?"\033[0m":"");} #else #define debug(...) {} #endif #define st first #define nd second #define dump_range(...) debug(cerr<<#__VA_ARGS__<<": ";print_range(__VA_ARGS__)) #define all(...) (__VA_ARGS__).begin(), (__VA_ARGS__).end() #define dump(...) debug(print(#__VA_ARGS__,'=',__VA_ARGS__)) using namespace std; using ll = long long; template< typename... t > using V = vector< t... >; void print(){cout << '\n';} template< typename t, typename... v > void print(const t& a, const v&... b) {cout << a << (sizeof...(b)?" ":"");print(b...);} int argc_; char** argv_; template< typename t > void print_range(t a, const t& b) {while (a != b) cout << (*a++) << ' '; cout << '\n';} /*thread_local mt19937 gen; inline ll arg(int v, ll def = 0) {return v < argc_? atoll(argv_[v]) : def;} template< typename t > t rng(t min, t max) {return uniform_int_distribution< t >{min, max}(gen);}*/ /*}}}*/ inline int foo(int v) { --v; int res = 0; for (int k = 2; k * k < v; ++k) if ((v % k) == 0) ++res; return res; } int main(int argc, char** argv) { argc_ = argc; argv_ = argv; ios::sync_with_stdio(false); cin.tie(nullptr); //gen = mt19937(arg(1)); int n; cin >> n; ll res = 0; for (int i = 1; i * i <= n; ++i) if (n % i == 0) { dump(i); res += foo(n / i); if (i * i != n) res += foo(i); } print(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 | /*{{{*/ #include <bits/stdc++.h> #ifdef LOCAL int c_; #define cout (c_?cerr:cout) #define debug(...) {cerr<<(!c_?"\033[96;1m":"");\ ++c_;__VA_ARGS__;--c_;cerr<<(!c_?"\033[0m":"");} #else #define debug(...) {} #endif #define st first #define nd second #define dump_range(...) debug(cerr<<#__VA_ARGS__<<": ";print_range(__VA_ARGS__)) #define all(...) (__VA_ARGS__).begin(), (__VA_ARGS__).end() #define dump(...) debug(print(#__VA_ARGS__,'=',__VA_ARGS__)) using namespace std; using ll = long long; template< typename... t > using V = vector< t... >; void print(){cout << '\n';} template< typename t, typename... v > void print(const t& a, const v&... b) {cout << a << (sizeof...(b)?" ":"");print(b...);} int argc_; char** argv_; template< typename t > void print_range(t a, const t& b) {while (a != b) cout << (*a++) << ' '; cout << '\n';} /*thread_local mt19937 gen; inline ll arg(int v, ll def = 0) {return v < argc_? atoll(argv_[v]) : def;} template< typename t > t rng(t min, t max) {return uniform_int_distribution< t >{min, max}(gen);}*/ /*}}}*/ inline int foo(int v) { --v; int res = 0; for (int k = 2; k * k < v; ++k) if ((v % k) == 0) ++res; return res; } int main(int argc, char** argv) { argc_ = argc; argv_ = argv; ios::sync_with_stdio(false); cin.tie(nullptr); //gen = mt19937(arg(1)); int n; cin >> n; ll res = 0; for (int i = 1; i * i <= n; ++i) if (n % i == 0) { dump(i); res += foo(n / i); if (i * i != n) res += foo(i); } print(res); } |