Problems Description
<span style="font-size:14px;"></span><span style="font-size:14px;">S1,S2…S2N是一items很好的括号。有两种不同的方式编码:</span> <p style="margin-left:0cm;"> <span style="font-size:14px;">有一items整数序列P1、P2 ,P =…PN,其中 Pi 是 S 的Page i items右括号前面的左括号items数。。</span> </p> <p style="margin-left:0cm;"> <span style="font-size:14px;">有一items整数序列W = W1,W2…WN,对于 S 中的某一items右括号 a,Wi 是从与 a 匹配的左括号开始数起,数到</span> </p> <p style="margin-left:0cm;"> <span style="font-size:14px;"> a 为止的右括号items数。</span> </p> <p style="margin-left:0cm;"> <span style="font-size:14px;">以下是上述编码的一items例子:</span> </p> <p style="margin-left:0cm;"> <span style="font-size:14px;">S(((()()())))</span> </p> <p style="margin-left:0cm;"> <span style="font-size:14px;">序列 </span><span style="font-size:14px;">4 5 6 6 6 6</span> </p> <p style="margin-left:0cm;"> <span style="font-size:14px;"> 1 1 1 4 5 6</span> </p> <p style="margin-left:0cm;"> <span style="font-size:14px;">写一items程序来转换编码</span> </p> <span style="font-size:14px;"></span>
Input格式
<p style="margin-left:0cm;background:white;"> <span style="font-size:14px;">输入的Page 一行包含一items整数T(1≤t≤10),为测试用例的数量,每items测试案例的Page 一行是一items整数N(1 < =</span> </p> <p style="margin-left:0cm;background:white;"> <span style="font-size:14px;"> n≤20),Page 二行是一itemsP字符串序列包含nitems正整数,中间用空格隔开。</span> </p>
Output格式
<span style="font-size:14px;"></span><span style="font-size:14px;line-height:1.5;background-color:white;">对于每一items测试案例,输Go out包含Nitems整数描述对应给定字符串的W序列。中间用空格隔开。</span><span style="font-size:14px;"><br /> </span>
Sample
Sample Input 1
2
6
4 5 6 6 6 6
9
4 6 6 6 6 8 9 9 9
Sample Output 1
1 1 1 4 5 6
1 1 2 4 5 1 1 3 9
Submit Code
请先Login后Submit
🤖 AI 解题助手
OpenRouter
就绪