-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfeb2
63 lines (57 loc) · 919 Bytes
/
feb2
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
52
53
54
55
56
57
58
59
60
61
62
63
#include <iostream>
using namespace std;
int main() {
int s_odd,s_even,i,x,k,m,n,t,done;
char s[1];
cin>>t;
while(t--)
{
cin>>n>>m>>x>>k;
s_even = 0;
s_odd = 0;
for(i=0;i<k;i++)
{
cin>>s[0];
if(s[0]=='E')
s_even += 1;
else
s_odd += 1;
}
done = 0;
for(i=1;i<=m;i++)
{
if(i%2==1)
{
if(x>=s_odd)
{
done = done + s_odd;
s_odd = 0;
}
else
{
s_odd = s_odd - x;
done = done + x;
}
}
else
{
if(x>=s_even)
{
done = done + s_even;
s_even = 0;
}
else
{
s_even = s_even -x;
done = done + x;
}
}
if(n<=done)
break;
}
if(n<=done)
cout<<"yes"<<endl;
else
cout<<"no"<<endl;
}
}