Test instructions is very simple, it is important to note that (2,5) and (6,9) processing, directly on the code:
1#include <iostream>2#include <cstring>3#include <cstdio>4 using namespacestd;5 6 Const intINF =1<< in;7 Const intN =Ten;8 Const intK201;9 intCnt1[n];Ten intCnt2[n]; One CharDigit[n]; A CharStr[m]; - - intSolve () the { -memset (Cnt1,0,sizeof(Cnt1)); -memset (Cnt2,0,sizeof(Cnt2)); - for(inti =0; I < strlen (digit); i++ ) + { -Cnt1[digit[i]-'0']++; + } A //Treats (2,5) as the same number and calculates two times atcnt1[2] + = cnt1[5], cnt1[5] = cnt1[2]; - //(6,9) as well . -cnt1[6] + = cnt1[9], cnt1[9] = cnt1[6]; - for(inti =0; I < strlen (str); i++ ) - { -Cnt2[str[i]-'0']++; in } -cnt2[2] + = cnt2[5], cnt2[5] = cnt2[2]; tocnt2[6] + = cnt2[9], cnt2[9] = cnt2[6]; + intAns =INF; - for(inti =0; i < N; i++ ) the { * if(Cnt1[i] = =0)Continue; $ intTMP = Cnt2[i]/Cnt1[i];Panax Notoginseng if(tmp < ans) ans =tmp; - } the returnans; + } A the intMain () + { - while(SCANF ("%s%s", digit, str)! =EOF) $ { $ intAns =solve (); -printf"%d\n", ans); - } the return 0; -}
Toj 4069 Summary Statistics