/* CodeForces 837D - Round Subset [ DP ] | Educational Codeforces Round 26 题意: 选k个数相乘让末尾0最多 分析: 第i个数字有a[i]个2, b[i] 个5 以其中一维作体积另一维作价值01背包即可 */ #include <bits/stdc++.h> using namespace std; int dp[205][20005]; int get2(long long x) { int s = 0; while (x % 2 == 0) s++, x /= 2; return s; } int get5(long long x) { int s = 0; while (x % 5 == 0) s++, x /= 5; return s; } int n, k; int main() { scanf("%d%d", &n, &k); memset(dp, -1, sizeof(dp)); dp[0][0] = 0; for (int i = 1; i <= n; i++) { long long x; scanf("%lld", &x); int a = get2(x); int b = get5(x); for (int j = k; j >= 1; j--) for (int p = a; p <= 20000; p++) if (dp[j-1][p-a] != -1) dp[j][p] = max(dp[j][p], dp[j-1][p-a] + b); } int ans = 0; for (int i = 1; i <= 20000; i++) if (dp[k][i] != -1) ans = max(ans, min(i, dp[k][i])); printf("%d ", ans); }