POJ 1068 Parencodings 模拟 难度:0
http://poj.org/problem?id=1068
#include<cstdio>
#include <cstring>
using namespace std;
int ind[45];
bool used[45];
int r[21];
int l[21];
int len,n,llen;
int w[21];
int main(){
int t;
scanf("%d",&t);
while(t--){
memset(used,0,sizeof(used));
len=0,llen=0;
scanf("%d",&n);
for(int i=0;i<n;i++){
scanf("%d",r+i);
for(int j=0;j<r[i]-(i>0?r[i-1]:0);j++){
ind[len++]=llen;
l[llen++]=i;
}
ind[len++]=i;
}
for(int i=0;i<n;i++){
int tind=r[i]+i;
used[tind]=true;
for(int j=tind-1;j>=0;j--){
if(!used[j]){
w[i]=i-l[ind[j]]+1;
used[j]=true;
break;
}
}
}
for(int i=0;i<n;i++)printf("%d%c",w[i],i==n-1?'\n':' ');
}
return 0;
}
POJ 1068 Parencodings 模拟 难度:0的更多相关文章
- [ACM] POJ 1068 Parencodings(模拟)
		
Parencodings Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 19352 Accepted: 11675 De ...
 - poj 1068 Parencodings 模拟
		
进入每个' ) '多少前' ( ', 我们力求在每' ) '多少前' ) ', 我的方法是最原始的图还原出来,去寻找')'. 用. . #include<stdio.h> #incl ...
 - poj 1068 Parencodings  模拟题
		
Description Let S = s1 s2...s2n be a well-formed string of parentheses. S can be encoded in two diff ...
 - 模拟 POJ 1068 Parencodings
		
题目地址:http://poj.org/problem?id=1068 /* 题意:给出每个右括号前的左括号总数(P序列),输出每对括号里的(包括自身)右括号总数(W序列) 模拟题:无算法,s数组把左 ...
 - POJ 1068 Parencodings【水模拟--数括号】
		
链接: http://poj.org/problem?id=1068 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=27454#probl ...
 - poj 1068 Parencodings(模拟)
		
转载请注明出处:viewmode=contents">http://blog.csdn.net/u012860063?viewmode=contents 题目链接:http://poj ...
 - POJ 2632 Crashing Robots 模拟 难度:0
		
http://poj.org/problem?id=2632 #include<cstdio> #include <cstring> #include <algorith ...
 - POJ 1573 Robot Motion 模拟 难度:0
		
#define ONLINE_JUDGE #include<cstdio> #include <cstring> #include <algorithm> usin ...
 - 快速切题 poj 2993 Emag eht htiw Em Pleh 模拟 难度:0
		
Emag eht htiw Em Pleh Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2806 Accepted: ...
 
随机推荐
- Linux_常用命令_02
			
1. 配置网络参数: (1).root登录 --> setup命令 进入到 "text mode setup utiliy" (2).运行命令"/etc/rc.d/ ...
 - 百度web前端面试2015.10.18
			
邮件里通知的周日下午两点参加百度校招面试,我13:10分就到了,前台先让我拿了个面试资格单(上面是我的信息),然后在web前端面试入口排队,面试在百度食堂举行的,等了大概1个小时,放我去面试.都是一对 ...
 - Oracle的热备份
			
一. 什么是热备份 热备份也叫联机备份,它是指数据库处于open状态下,对数据库的数据文件.控制文件.参数文件.密码文件等进行一系列备份操作(其中数据文件是必须备份的). 它要求数据库处在归档模式下. ...
 - 【Todo】Java新技术学习笔记-from某技术分析
			
看到这篇文章:http://mt.sohu.com/20160806/n462923089.shtml <十余年技术大牛告诉你,这些Java新技术不可错过> 虽然讲的比较泛,但是里面提到的 ...
 - iOS开发 判断用户是否开启了热点
			
- (BOOL)achiveUserHotspotOpening { return [UIApplication sharedApplication].statusBarFrame.size.heig ...
 - angular 零碎知识
			
各种服务: $location:可以监听事件的改变 link 在没有设置template的情况下,指令作为标签使用的时候,ele是指令(伪数组的形式); * 如果指令作为属性使用的话,ele是使用该指 ...
 - selenium+python笔记4
			
#!/usr/bin/env python # -*- coding: utf-8 -*- """ @desc: 使用unittest组织用例 ""& ...
 - 1029c语言文法
			
<程序>→<外部声明>|<程序><外部声明> <外部声明>→<函数定义>|<声明> <函数定义>→< ...
 - [转载]使用SoapUI进行负载测试
			
使用了SoapUI进行负载测试 http://www.cnblogs.com/zerotest/p/4668918.html 负载测试是相当独特的,我们已经创建了一个功能,使您能够快速创建性能测试,并 ...
 - hdu------(1525)Euclid's Game(博弈决策树)
			
Euclid's Game Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...