标签:
Time Limit: 5000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 6283 Accepted Submission(s):
3805
#include<stdio.h> #include<string.h> #define MAX 1100 int main() { int n,m,j,i,sum,l,top; char s[MAX]; char zhan[MAX]; while(gets(s)) { top=0; l=strlen(s); for(i=0;i<l;i++) { if(s[i]==‘(‘) { zhan[top++]=s[i]; } else if(s[i]==‘)‘) { if(zhan[top-1]==‘(‘) top--; } else if(s[i]==‘B‘) break; } printf("%d\n",top); } return 0; }
标签:
原文地址:http://www.cnblogs.com/tonghao/p/4567412.html