//Karol Kaszuba #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef vector<int> VI; typedef pair<int, int> PII; typedef double D; typedef long double LD; typedef vector<PII> VII; typedef unordered_set<int> USI; typedef unordered_set<LL> USLL; #define FOR(i,x,y) for(auto i=(x);i<=(y);++i) #define REP(i,x) FOR(i,0,(x)-1) #define FORD(i,x,y) for(auto i=(x);i>=(y);--i) #define VAR(i,c) __typeof(c) i=(c) #define FORE(i,c) for(VAR(i,(c).begin());i!=(c).end();++i) #define SIZE(c) (int)((c).size()) #define ALL(c) (c).begin(),(c).end() #define PB push_back #define EB emplace_back #define IN insert #define ER erase #define MP make_pair #define ST first #define ND second #define IOSYNC ios_base::sync_with_stdio(0) #define FREOPEN(f) freopen(f, "r", stdin),freopen(f, "w", stdout) VI dzielniki(int n) { set<int> secik; for (int i = 1; i * i <= n; i++) { if (n % i == 0) { secik.insert(i); secik.insert(n / i); } } return VI(ALL(secik)); } void jebaj() { int n; cin >> n; auto dz = dzielniki(n); int res = 0; for (int a : dz) { int x = n / a - 1; auto cz = dzielniki(x); for (int b : cz) res += (b > 1 && x / b > 2); } cout << res << "\n"; } int main() { IOSYNC; int t; t = 1; while(t--) jebaj(); 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 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 | //Karol Kaszuba #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef vector<int> VI; typedef pair<int, int> PII; typedef double D; typedef long double LD; typedef vector<PII> VII; typedef unordered_set<int> USI; typedef unordered_set<LL> USLL; #define FOR(i,x,y) for(auto i=(x);i<=(y);++i) #define REP(i,x) FOR(i,0,(x)-1) #define FORD(i,x,y) for(auto i=(x);i>=(y);--i) #define VAR(i,c) __typeof(c) i=(c) #define FORE(i,c) for(VAR(i,(c).begin());i!=(c).end();++i) #define SIZE(c) (int)((c).size()) #define ALL(c) (c).begin(),(c).end() #define PB push_back #define EB emplace_back #define IN insert #define ER erase #define MP make_pair #define ST first #define ND second #define IOSYNC ios_base::sync_with_stdio(0) #define FREOPEN(f) freopen(f, "r", stdin),freopen(f, "w", stdout) VI dzielniki(int n) { set<int> secik; for (int i = 1; i * i <= n; i++) { if (n % i == 0) { secik.insert(i); secik.insert(n / i); } } return VI(ALL(secik)); } void jebaj() { int n; cin >> n; auto dz = dzielniki(n); int res = 0; for (int a : dz) { int x = n / a - 1; auto cz = dzielniki(x); for (int b : cz) res += (b > 1 && x / b > 2); } cout << res << "\n"; } int main() { IOSYNC; int t; t = 1; while(t--) jebaj(); return 0; } |