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

#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. js控制日期选择框datetime-local和select的展开

    注: js控制元素展开不受元素css属性的限制,例如opacity,z-index等 1. 使用js控制日期选择框的展开 ios: document.querySelector(".targ ...

  2. Android:如何实现更换主题

    关键代码:setTheme(int ID); 注意点: 1.设置主题必须要在setContentView() 之前调用,所以需要写个Intent去重新开启Activity. 2.为了切换主题保证流畅性 ...

  3. 二十二、oracle pl/sql分类二 函数

    函数用于返回特定的数据,当建立函数时,在函数头部必须包含return子句.而在函数体内必须包含return语句返回的数据.我们可以使用create function来建立函数. 1).接下来通过一个案 ...

  4. HDU - 2586 How far away ?(LCA模板题)

    HDU - 2586 How far away ? Time Limit: 1000MS   Memory Limit: 32768KB   64bit IO Format: %I64d & ...

  5. ubuntu server 时区设置问题解决

    1.当执行此命令的时候 ntpdate us.pool.ntp.org 出现一下错误提示 name server cannot be used: Temporary failure in name r ...

  6. android常用工具类

    import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkIn ...

  7. ios文本框基本使用,以及所有代理方法的作用

    /* UITextField文本输入框 */ UITextField * textField = [[UITextField alloc]initWithFrame:CGRectMake(50, 50 ...

  8. VBS 批量修改多个文件夹下的文字命名

    Function FilesTree(sPath)      Set oFso = CreateObject("Scripting.FileSystemObject")       ...

  9. 在Dll中创建对话框并调用

    1.第一步创建一“MFC AppWizard (dll)”工程,接下来选择“Regular Dll using shared MFC DLL”,点击“Finish”. 2.添加一对话框资源到工程中,从 ...

  10. iOS之图文混排

    首先从github下载 https://github.com/wezm/RegexKitLite 导入.h和.m文件后为RegexKitLite.m添加编译标记-fno-objc-arc.添加动态库l ...