dev c++上都能出正确结果,不知道为什么评测全RE
求大佬解答
#include<stdio.h>
#include<cstdio>
char s[300];
int check(char s[300])
{
int top = 0,i=0;
while (s[i] != '@')
{
if (s[i] == '(')
top++;
if (s[i] == ')')
top--;
i++;
}
if (top!=0)
return 0;
return 1;
}
int main()
{
int i = 0;
char c=getchar();
while (c != '@')
{
s[i] = c;
c = getchar();
i++;
}
if (check(s) == 0)
printf("NO");
else
printf("YES");
return 0;
}