poj1068 模拟
来源:互联网 发布:重庆网络品牌建设平台 编辑:程序博客网 时间:2024/05/21 14:08
#include<iostream>using namespace std;int p[25] = { 0 }, w[25] = { 0 },m=0,x=0,n=0;char S[60] = { '\0' };int f(){int s = 1;while (x<n){if (S[m] == '('){m++;s+= f();}else{w[x] = s;x++;m++;return s;}}}int main(){int t = 0,i=0,j=0,k=0,l=0;cin >> t;while (t--){cin >> n;for (i = 0,l=0,k=0; i < n; i++){cin >> p[i];for (j = 0; j < p[i] - k; j++){S[l] = '(';l++;}S[l] = ')';l++;k = p[i];}m = x = 0;f();for (i = 0; i < n; i++){cout << w[i] << " ";}cout << endl;}}
0 0
- poj1068 模拟
- poj1068 模拟
- POJ1068(模拟)
- POJ1068模拟
- POJ1068《Parencodings》方法:模拟
- POJ1068 Parencodings(模拟)
- POJ1068 Parencodings(模拟)
- POJ1068 Parencodings 模拟题
- poj1068模拟法
- POJ1068 Parencodings(模拟)
- poj1068 Parencodings 【模拟】
- poj1068 Parencodings 模拟 栈
- POJ1068(ACM括号模拟)
- POJ1068 Parencodings (模拟)
- Parencodings(POJ1068 模拟)
- Parencodings(poj1068简单模拟)
- poj1068 Parencodings 模拟水题
- POJ1068双端队列模拟
- Java学习笔记11:在公共类中使用访问方法而非公有域
- Golang第三天
- Two sum
- mysql服务的启动
- 对Javascript的一些误解
- poj1068 模拟
- 7z 命令行 进行单文件极限压缩与解压
- java 反射
- PHP+Mysql————表单数据插入数据库及数据提取
- git 常用命令
- mysql基本操作
- http和socket区别
- 2014.10.6模拟赛【魔兽争霸】
- Win7 X64 python3安装pycrypto, Unable to find vcvarsall.bat