mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 1880.cpp
This commit is contained in:
parent
4b418100d3
commit
ec4354b880
32
QUSTOJ/1880.cpp
Normal file
32
QUSTOJ/1880.cpp
Normal file
|
@ -0,0 +1,32 @@
|
|||
#include <iostream>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
string str1;
|
||||
int main()
|
||||
{
|
||||
int n,m;
|
||||
cin>>n>>m;
|
||||
for(int i=0; i<n; i++)
|
||||
{
|
||||
int w=1,t=0;
|
||||
cin>>str1;
|
||||
int sz=str1.size();
|
||||
for(int j=0; j<sz; j++)
|
||||
{
|
||||
if(str1.at(j)=='S')
|
||||
t++;
|
||||
else
|
||||
t--;
|
||||
if(t>m||t<0)
|
||||
{
|
||||
w=0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(w==1&&t==0)
|
||||
cout<<"YES"<<endl;
|
||||
else
|
||||
cout<<"NO"<<endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user