Untitled
ducsieumanh1hitlanamguku
plain_text
19 days ago
496 B
3
Indexable
Never
#include <bits/stdc++.h> using namespace std; string a; int xn[30]; int so2=0; int so5=0; void mminus(int m) { int x=m; while (x>=5) { so5-=x/5; x/=5; } while (m>=2) { so2=m/2; m/=2; } } int main() { cin>>a; for (int i=0;i<a.size();i++) { xn[a[i]-96]++; } int x=a.size(); while (x>=5) { so5+=x/5; x/=5; } x=a.size(); while (x>=2) { so2+=x/2; x/=2; } for (int i=1;i<=26;i++) { mminus(xn[i]); } cout<<min(so2,so5); }
Leave a Comment