mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 1870.cpp
This commit is contained in:
parent
3b6c42acbb
commit
cbcc36c153
21
HDOJ/1870.cpp
Normal file
21
HDOJ/1870.cpp
Normal file
|
@ -0,0 +1,21 @@
|
|||
#include <cstdlib>
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
using namespace std;
|
||||
|
||||
char buffer[1024];
|
||||
int main()
|
||||
{
|
||||
while(scanf("%s",buffer)==1)
|
||||
{
|
||||
int idt=strstr(buffer,"B")-buffer;
|
||||
int cnt=0;
|
||||
for(int i=idt-1;i>=0;i--)
|
||||
{
|
||||
if(buffer[i]=='(') cnt++;
|
||||
else cnt--;
|
||||
}
|
||||
printf("%d\n",cnt);
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user