PAT1003我要通过(20)

#include
#include
#include
using namespace std;
int main()
{
int n;
vector v;
string str;
while(scanf("%d",&n) != EOF)
{
int i;
for(i = 0;i < n;i++)
{
cin>>str;
size_t a = str.find_first_not_of("A");
if(a == string::npos || str[a] != 'P')
{
v.push_back("NO");
continue;
}
size_t b = str.find_first_not_of("A",a+1);
if(b == string::npos || b == a+1 || str[b] != 'T')
{
v.push_back("NO");
continue;
}
size_t c = str.find_first_not_of("A",b+1);
if(c != string::npos )
v.push_back("NO");
else if(a * (b-a-1) == (str.length()-b-1))
{
v.push_back("YES");
}
else v.push_back("NO");
}
for(i = 0;i < n;i++)
{

cout< }
}
system("pause");
return 0;

}

这道题关键是理解题意。

你可能感兴趣的:(PAT)