fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. bool dziel5(int n)
  5. {
  6. int licz{};
  7. int p = 2;
  8. int sq = round(sqrt(n));
  9. while(n > 1 && p <= sq)
  10. {
  11. if(n % p == 0)
  12. {
  13. licz++;
  14. while(n % p == 0)
  15. n = n / p;
  16. }
  17. p++;
  18. }
  19. if(n > 1) licz++;
  20. return (licz >= 5);
  21. }
  22.  
  23. int main()
  24. {
  25. int N; cin >> N;
  26. int cnt{};
  27. for(int i=0; i<N; i++)
  28. {
  29. int k; cin >> k;
  30. if(dziel5(k))
  31. {
  32. cnt++;
  33. cout << k << '\n';
  34. }
  35. }
  36. if(cnt == 0)
  37. cout << "BRAK\n";
  38. return 0;
  39. }
Success #stdin #stdout 0s 544KB
stdin
6
4620
900
1024
1
21945
111111111
stdout
4620
21945