lina_os

Untitled

Apr 3rd, 2025
12
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3.  
  4. using namespace std;
  5.  
  6. set<ll>c;
  7.  
  8. void fac(int n, set<ll>s) {
  9. for (int i=2; i<=n; i++) {
  10. if (n%i==0) {
  11. c.insert(i);
  12. s.insert(i);
  13. while (n>0 && n%i==0) {
  14. n/=i;
  15. }
  16. }
  17. }
  18. if (s.empty()) c.insert(n);
  19. }
  20.  
  21. int main() {
  22. ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  23. int n;
  24. cin >> n;
  25. while (n--) {
  26. int x;
  27. cin >> x;
  28. fac(x,c);
  29. }
  30. // for (auto i:c) cout << i << " ";
  31. cout << c.size();
  32. return 0;
  33. }
  34.  
Advertisement
Add Comment
Please, Sign In to add comment