运行测试结果,第5个测点过不去
![在这里插入图片描述](https://img-blog.csdnimg.cn/20181130131122899.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L21hb19rZXJhbmc=,size_16,color_FFFFFF,t_70)
代码C++
#include<iostream>
#include<string.h>
using namespace std;
void judge(char *s);
int main()
{
int n;
cin >> n;
getchar();
while (n-- > 0)
{
char str[100];
cin.getline(str, 100);
judge(str);
}
return 0;
}
void judge(char *s)
{
char *p = s;
int count[3] = { 0 };
int index = 0;
while (*p != '\0')
{
if (*p == 'A')
count[index] += 1;
else if (index == 0 && *p == 'P')
index++;
else if (index == 1 && *p == 'T')
index++;
else
break;
p++;
}
if (count[1] != 0 && (index == 2) && (count[2] == count[0] * count[1]))
cout << "YES" << endl;
else
cout << "NO" << endl;
}
请大佬帮忙!!! 感谢