forked from shrox/Random-Codes
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdaddandsocks.c
More file actions
48 lines (40 loc) · 771 Bytes
/
daddandsocks.c
File metadata and controls
48 lines (40 loc) · 771 Bytes
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
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
int N,x,series[1000000]={0},number1=0,number2=0;
char colour[10];
scanf("%d",&N);
for(x=0; x<N; x++)
{
scanf("%s",colour);
colour[5] = '\0';
//printf("%C\n",colour[3]);
if(colour[2] == 'U')
{
// printf("U");
series[x] = 1;
// printf("x %d and series[x] %d\n",x,series[x]);
}
else if (colour[2] == 'A')
{
series[x] = 2;
// printf("x %d and series[x] %d\n",x,series[x]);
}
}
series[N] = '\0';
for(x=0;x<N;x++)
{
if(series[x] == 1)
number1++;
else if (series[x] == 2)
number2++;
}
if(number1%2 == 0 && number2%2 == 0)
printf("YEs\n");
else
printf("NO\n");
printf("%d %d %d %d\n",number1/2,number2/2,number1%2,number2%2);
return 0;
}