Codeforces Roma and Lucky Numbers
//#include<cstdio>
//#include<iostream>
//#include<algorithm>
//#include<vector>
//#include<cstring>
//#include<cmath>
//#include<map>
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false)
#define bfast cin.tie(0)
#define outs(x) cout << x << " "
#define outn(x) cout << x << "\n"
#define sf scanf
#define pf printf
typedef long long LL;
typedef vector<int>vii;
typedef vector<LL>vll;
int main()
{
fast;
int n,k ;
LL cnt=0, ans=0 , i , len=0;
string s;
while(cin >> n >> k)
{
cnt=0;
ans=0;
while(n--)
{
cin >> s;
len = s.length();
cnt=0;
for(i=0; i<len; i++)
{
if(s[i] == '4' or s[i] == '7') cnt++;
}
if(cnt <= k) ans++;
}
outn(ans);
}
return 0;
}
//#include<iostream>
//#include<algorithm>
//#include<vector>
//#include<cstring>
//#include<cmath>
//#include<map>
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false)
#define bfast cin.tie(0)
#define outs(x) cout << x << " "
#define outn(x) cout << x << "\n"
#define sf scanf
#define pf printf
typedef long long LL;
typedef vector<int>vii;
typedef vector<LL>vll;
int main()
{
fast;
int n,k ;
LL cnt=0, ans=0 , i , len=0;
string s;
while(cin >> n >> k)
{
cnt=0;
ans=0;
while(n--)
{
cin >> s;
len = s.length();
cnt=0;
for(i=0; i<len; i++)
{
if(s[i] == '4' or s[i] == '7') cnt++;
}
if(cnt <= k) ans++;
}
outn(ans);
}
return 0;
}
Comments
Post a Comment