fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. ios::sync_with_stdio(false);
  6. cin.tie(nullptr);
  7.  
  8. int M;
  9. cin >> M;
  10.  
  11. long long cnt2 = 0, cnt5 = 0;
  12.  
  13. for (int i = 0; i < M; i++) {
  14. long long x;
  15. cin >> x;
  16.  
  17. while (x % 2 == 0) {
  18. cnt2++;
  19. x /= 2;
  20. }
  21. while (x % 5 == 0) {
  22. cnt5++;
  23. x /= 5;
  24. }
  25. }
  26.  
  27. cout << min(cnt2, cnt5);
  28. return 0;
  29. }
  30.  
Success #stdin #stdout 0.01s 5284KB
stdin
4
2
9
10
15 
stdout
2