题目链接:http://codeforces.com/problemset/problem/328/B
水题~
1 #include <cstdio> 2 #include <cstdlib> 3 #include <cstring> 4 char n[10], a[202]; 5 int b[13], c[13]; 6 int main(void) { 7 //freopen("in.txt", "r", stdin); 8 scanf("%s%s", n, a); 9 int len1 = strlen(n), len2 = strlen(a); 10 memset(b, 0, sizeof(b)); memset(c, 0, sizeof(c)); 11 for (int i = 0; i < len1; ++i) b[n[i]-'0']++; 12 for (int i = 0; i < len2; ++i) c[a[i]-'0']++; 13 b[2]+=b[5], b[5]=0, c[2]+=c[5], c[5]=0, b[6]+=b[9], b[9]=0, c[6]+=c[9], c[9]=0; 14 int cnt=0, Max=100000; 15 for (int i = 0; i < 10; ++i){ 16 if (b[i]){ 17 cnt = c[i]/b[i]; if (cnt < Max) Max = cnt; 18 } 19 } 20 printf("%d\n", Max); 21 return 0; 22 }
=_=