poj 1068 Parencodings 模拟
来源:互联网 发布:淘宝认证复核失败2017 编辑:程序博客网 时间:2024/05/18 02:10
输入的是在每个' ) '前有多少‘ ( ’,
要我们求得是在每个‘ ) ’前有多少个‘ ) ’,
我的方法是将最原始的图給还原出来,再去寻找‘)’。
对于已经配对的要进行标记不要重复使用。。
#include<stdio.h>#include<string.h>int y[505],t[505];char s[505];int main(){int a,b,i,j,u;scanf("%d",&a);while(a--){memset(y,0,sizeof(y));memset(t,0,sizeof(t));memset(s,0,sizeof(s));scanf("%d",&b);for(i=0;i<b;i++){scanf("%d",&y[i]);}int sum=1;int ans;for(i=0,j=0;i<505;i++){if(sum<=y[j]){s[i]='(';sum++;}else{s[i]=')';j++;}if(j>=b)break;}u=strlen(s);for(i=0;i<u;i++){if(s[i]=='(')continue;else{ans=1;t[i]=1;for(j=i-1;j>=0;j--){if(s[j]==')')ans++;if(t[j]==0){if(s[j]=='('){t[j]=1;break;}}}printf("%d ",ans);}}printf("\n");}return 0;}
0 0
- POJ 1068 Parencodings 模拟
- poj 1068 Parencodings (模拟)
- poj 1068 Parencodings 模拟
- POJ 1068-Parencodings(模拟)
- poj 1068 Parencodings(模拟)
- poj 1068 Parencodings 模拟
- POJ - 1068 Parencodings 模拟
- POJ 1068 Parencodings <模拟>
- POJ 1068 Parencodings 模拟题
- poj 1068 Parencodings(模拟)
- poj 1068 Parencodings(模拟)
- POJ 1068 Parencodings 栈模拟
- poj 1068 Parencodings(模拟)
- poj 1068 Parencodings(模拟)
- POJ 1068 Parencodings (模拟)
- poj 1068 Parencodings(模拟)
- poj 1068 Parencodings(模拟)
- POJ 1068 Parencodings(模拟)
- 【Android动画】之Tween动画 (渐变、缩放、位移、旋转)
- 源码网站代码大全
- 10.5 在方法和作用域内的内部类
- android 系统 makefile文件(Android.mk)组织结构
- Hash表
- poj 1068 Parencodings 模拟
- JAVA 五子棋 判断输赢的代码实现
- 在Java与C/C++间应用简单的消息队列------<初学>
- C语言中__DATE__,__TIME__,__FILE__和__LINE__的用途
- 开发者服务商店:程序员的6个好习惯
- SAR/GMTI-概述及常用抑制杂波方法DPCA
- apache配置 <Directory> 指令
- html5 canvas 绘制图像、画布或视频
- new/malloc 区别