水题,括号匹配,有几对匹配了,答案就是那个...

#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std; int Stack[];
int top; int main()
{
int T;
char a[];
scanf("%d",&T);
while(T--)
{
int ans=;
top=-;
scanf("%s",a);
int len=strlen(a);
for(int i=; i<len; i++)
{
if(a[i]=='(')
{
top++;
Stack[top]=;
}
else
{
if(Stack[top]==)
{
top--;
ans++;
}
else
{
top++;
Stack[top]=;
}
}
} printf("%d\n",ans);
}
return ;
}

HDU 5479 Scaena Felix的更多相关文章

  1. hdoj Scaena Felix

    Scaena Felix Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Tota ...

  2. hdu 5479(括号问题)

    题意:类似"()","(())","()()" 是匹配的, 而 "((", ")(", " ...

  3. HDOJ 2111. Saving HDU 贪心 结构体排序

    Saving HDU Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  4. 【HDU 3037】Saving Beans Lucas定理模板

    http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...

  5. hdu 4859 海岸线 Bestcoder Round 1

    http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...

  6. HDU 4569 Special equations(取模)

    Special equations Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u S ...

  7. HDU 4006The kth great number(K大数 +小顶堆)

    The kth great number Time Limit:1000MS     Memory Limit:65768KB     64bit IO Format:%I64d & %I64 ...

  8. HDU 1796How many integers can you find(容斥原理)

    How many integers can you find Time Limit:5000MS     Memory Limit:32768KB     64bit IO Format:%I64d ...

  9. hdu 4481 Time travel(高斯求期望)(转)

    (转)http://blog.csdn.net/u013081425/article/details/39240021 http://acm.hdu.edu.cn/showproblem.php?pi ...

随机推荐

  1. CURL访问url显示响应时间

    curl -o /dev/null -s -w %{time_connect}:%{time_starttransfer}:%{time_total} http://www.baidu.com 时间指 ...

  2. 2015 ACM/ICPC Asia Regional Hefei Online

    1001 Monitor the Alpacas 1002 The Relationship in Club 1003 Difference of Clustering 两边离散化.暴力扫C就过了. ...

  3. 正则表达式 Pattern & Matcher

    1 compile and pattern Pattern类用于创建一个正则表达式,也可以说创建一个匹配模式,它的构造方法是私有的,不可以直接创建,但可以通过Pattern.complie(Strin ...

  4. SELinux Policy Macros

    参考:http://selinuxproject.org/page/NB_RefPolicy Directory Macros macro expansion getattr_dir_perms ge ...

  5. Vasya and String(尺取法)

    Vasya and String time limit per test 1 second memory limit per test 256 megabytes input standard inp ...

  6. docker 基础命令

    检查Docker安装是否正确docker info拉取镜像docker pull (image name)启动docker run -d -d 后台运行查看日志docker logs $sample_ ...

  7. 有了SSL证书,如何在IIS环境下部署https?【转载】

    昨天各位小伙伴都很开心的领取了自己的SSL证书,但是大部分小伙伴却不知道如何部署,也许是因为第一次接触SSL这种高端的东西吧,不过个人觉得就是懒懒懒...本来小编也挺懒的,但是答应了各位小伙伴的,那么 ...

  8. js获取tr,td内容并排序

    如题 <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.o ...

  9. Failed to load c++ bson extension, using pure JS version

    Failed to load c++ bson extension, using pure JS version npm install mongodbnpm install bson npm ins ...

  10. PHP安装后php-config命令干嘛的

    php-config 是一个简单的命令行脚本用于查看所安装的 PHP 配置的信息. 我们在命令行执行 php-config 会输出所有的配置信息 Usage: /usr/local/php/bin/p ...