fork download
  1. //Bai 2
  2.  
  3. #include<bits/stdc++.h>
  4. using namespace std;
  5. #define el "\n"
  6. #define ll long long
  7. #define ull unsigned long long
  8. #define se second
  9. #define fi first
  10. #define be begin
  11. #define en end
  12. #define Faster cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
  13. ll Factorial (ll n)
  14. {
  15. if(n == 0 || n == 1) return 1;
  16. return n * Factorial(n - 1);
  17. }
  18. void Run(ll n)
  19. {
  20. cin >> n;
  21. ll ans = Factorial(n);
  22. string s = to_string(ans);
  23. ll dem = 0;
  24. for(int i = s.size() - 1; i >= 0; i--)
  25. {
  26. if(s[i] == '0') dem++;
  27. else break;
  28. }
  29. cout << ans << " " << dem;
  30. }
  31. int main()
  32. {
  33. Faster;
  34. ll n;
  35. Run(n);
  36. return 0;
  37. }
  38.  
  39.  
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
1 0