-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path373A.cpp
51 lines (48 loc) · 798 Bytes
/
373A.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <stdio.h>
#include <stdlib.h>
int main()
{
int i,k,j;
int oc[10]={0,0,0,0,0,0,0,0,0,0};
char a[5],b[5],c[5],d[5];
scanf(" %d ",&k);
k=k*2;
gets(a);
gets(b);
gets(c);
gets(d);
for(i=0;i<4;i++)
{
if(a[i]=='.') continue;
j=a[i]-'0';
oc[j]++;
}
for(i=0;i<4;i++)
{
if(b[i]=='.') continue;
j=b[i]-'0';
oc[j]++;
}
for(i=0;i<4;i++)
{
if(c[i]=='.') continue;
j=c[i]-'0';
oc[j]++;
}
for(i=0;i<4;i++)
{
if(d[i]=='.') continue;
j=d[i]-'0';
oc[j]++;
}
for(i=1;i<10;i++)
{
if(oc[i]>k){
printf("NO\n");
break;
}
}
if(i==10)
printf("YES\n");
return 0;
}