fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define ll long long
  4. #define all(x) x.begin(), x.end()
  5. const int N = 1e6 + 5;
  6. bool checkPrime(ll n)
  7. {
  8. if(n == 2 || n == 3) return true;
  9. if(n < 2 || n%2 == 0 || n%3 == 0) return false;
  10. for(int i = 5; 1ll*i*i <= n; i+=6){
  11. if(n%i == 0 || n%(i+2) == 0) return false;
  12. }
  13. return true;
  14. }
  15. int main() {
  16. ios_base::sync_with_stdio(false);
  17. cin.tie(NULL); cout.tie(NULL);
  18. ll n, cnt = 0;
  19. cin>>n;
  20. for(int i=1;i<=sqrt(n);++i){
  21. if(n%i==0){
  22. if(!checkPrime(i)) cnt++;
  23. if(n/i != i){
  24. if(!checkPrime(n/i)) cnt++;
  25. }
  26. }
  27. }
  28. cout<<cnt;
  29. }
  30.  
Success #stdin #stdout 0.12s 5288KB
stdin
Standard input is empty
stdout
21