首页 > 其他 > 详细

hdu 5479

时间:2015-09-28 23:49:51      阅读:296      评论:0      收藏:0      [点我收藏+]

BestCoder Round #57 第一题,水题直接上代码。

 

 1 #include<cstdio>
 2 #include<cstring>
 3 #include<iostream>
 4 #include<algorithm>
 5 using namespace std;
 6 char st[1005];
 7 int t;
 8 int main()
 9 {
10 scanf("%d ",&t);
11 while(t--)
12 {
13 gets(st);
14 int len=strlen(st);
15 int sum=0,ans=0;
16 for(int i=0; i<len; i++)
17 {
18 if(st[i]==()
19 sum++;
20 if(st[i]==)&&sum>0)
21 sum--,ans++;
22 }
23 printf("%d\n",ans);
24 }
25 return 0;
26 }

 

hdu 5479

原文:http://www.cnblogs.com/zzulipomelo/p/4845207.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!