lina_os

Untitled

Apr 3rd, 2025
10
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 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. map<int,int>m;
  8. vector<int>v;
  9.  
  10. void fac(int n) {
  11. int f=0;
  12. for (int i=2; i<=n; i++) {
  13. if (n%i==0) {
  14. f++;
  15. if (!m[i]) {
  16. m[i]++;
  17. v.push_back(i);
  18. }
  19. // c.insert(i);
  20. // s.insert(i);
  21. while (n>0 && n%i==0) {
  22. n/=i;
  23. }
  24. }
  25. }
  26. if (!f) v.push_back(n);
  27. }
  28.  
  29. int main() {
  30. ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
  31. int n;
  32. cin >> n;
  33. while (n--) {
  34. int x;
  35. cin >> x;
  36. fac(x);
  37. }
  38. // for (auto i:c) cout << i << " ";
  39. cout << v.size();
  40. return 0;
  41. }
  42.  
Advertisement
Add Comment
Please, Sign In to add comment