Advertisement
rotti321

problema_cu fact

Mar 9th, 2022
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3. using namespace std;
  4.  
  5. int nr_zero(int n) {
  6. int k = 0, p = 5;
  7. while(p<=n){
  8. k = k +n/p;
  9. p=p*5;
  10. }
  11. return k;
  12. }
  13.  
  14. int main() {
  15. int k_maxx = -1, cnt = 0, a, n;
  16. while(cin>>n){
  17. a = nr_zero(n);
  18. if(a > k_maxx) {
  19. k_maxx = a;
  20. cnt = 1;
  21. }
  22. else if(a == k_maxx) cnt++;
  23. }
  24. cout << cnt << ' ' << k_maxx;
  25. return 0;
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement