http://acm.hust.edu.cn/vjudge/contest/view.action?cid=26100#problem/A

A - A

Time Limit:1000MS     Memory Limit:30000KB     64bit IO Format:%I64d & %I64u

Description

You have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way. Because of pending patent issues we will not discuss in detail how the strings are generated and inserted into the original message. To validate your method, however, it is necessary to write a program that checks if the message is really encoded in the final string.

Given two strings s and t, you have to decide whether s is a subsequence of t, i.e. if you can remove characters from t such that the concatenation of the remaining characters is s.

Input

The input contains several testcases. Each is specified by two strings s, t of alphanumeric ASCII characters separated by whitespace.The length of s and t will no more than 100000.

Output

For each test case output "Yes", if s is a subsequence of t,otherwise output "No".

Sample Input

sequence subsequence
person compression
VERDI vivaVittorioEmanueleReDiItalia
caseDoesMatter CaseDoesMatter

Sample Output

Yes
No
Yes
No

 //是很简单的题啦  但是我数组开的有点小 总是runtime error
#include<stdio.h>
#include<string.h>
char a[];
char b[];
int main()
{
int i,j,na,nb,t = ,m = ;
char c;
while(scanf("%s",a) != EOF)
{
scanf("%s",b);
na = strlen(a);
nb = strlen(b);
for(i = ;i < na;i++)
{
for(j = t;j < nb;j++)
{
if(a[i] == b[j])
{
m++;
t = j + ;
break;
}
}
}
if(m == na )printf("Yes\n");
else printf("No\n");
m = ;
t = ;
}
return ;
}
B - B

Time Limit:1000MS     Memory Limit:10000KB     64bit IO Format:%I64d & %I64u

Description

Let S = s1 s2...s2n be a well-formed string of parentheses. S can be encoded in two different ways: 
q By an integer sequence P = p1 p2...pn where pi is the number of left parentheses before the ith right parenthesis in S (P-sequence). 
q By an integer sequence W = w1 w2...wn where for each right parenthesis, say a in S, we associate an integer which is the number of right parentheses counting from the matched left parenthesis of a up to a. (W-sequence).

Following is an example of the above encodings:

	S		(((()()())))

P-sequence 4 5 6666

W-sequence 1 1 1456

Write a program to convert P-sequence of a well-formed string to the W-sequence of the same string. 

Input

The first line of the input contains a single integer t (1 <= t <= 10), the number of test cases, followed by the input data for each test case. The first line of each test case is an integer n (1 <= n <= 20), and the second line is the P-sequence of a well-formed string. It contains n positive integers, separated with blanks, representing the P-sequence.

Output

The output file consists of exactly t lines corresponding to test cases. For each test case, the output line should contain n integers describing the W-sequence of the string corresponding to its given P-sequence.

Sample Input

2
6
4 5 6 6 6 6
9
4 6 6 6 6 8 9 9 9

Sample Output

1 1 1 4 5 6
1 1 2 4 5 1 1 3 9

 //先把括号的情况还原,在用递归的方法给括号配对,递归不是很熟练,虽然很简单,写了好几遍才对。
#include<stdio.h>
char y[];
int w[],n,l,j;
int f()
{
int s=;
while()
if(y[j]=='(')
{
j++;
s+=f();
}
else
{
w[l++]=s;
j++;
return s;
}
}
int main()
{
int N,i,k,m;
scanf("%d",&N);
while(N--)
{
scanf("%d",&n);
for(i=,l=,k=;i<n;i++)
{
scanf("%d",&m);
for(j=;j<m-k;j++)
y[l++]='(';
y[l++]=')';
k=m;
}
l=j=;
f();
for(i=;i<n;i++)
printf("%d ",w[i]);
printf("\n");
}
return ;
}

OUC_Summer Training_ DIV2_#4之数据结构的更多相关文章

  1. OUC_Summer Training_ DIV2_#16 725

    今天做了这两道题真的好高兴啊!!我一直知道自己很渣,又贪玩不像别人那样用功,又没有别人有天赋.所以感觉在ACM也没有学到什么东西,没有多少进步.但是今天的B题告诉我,进步虽然不明显,但是只要坚持努力的 ...

  2. OUC_Summer Training_ DIV2_#13 723afternoon

    A - Shaass and Oskols Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I ...

  3. OUC_Summer Training_ DIV2_#12(DP1) 723

    这一次是做练习,主要了解了两个算法,最大子矩阵和,最长上升子序列. 先看题好啦. A - To The Max Time Limit:1000MS     Memory Limit:32768KB   ...

  4. OUC_Summer Training_ DIV2_#14 724

    又落下好多题解啊...先把今天的写上好了. A - Snow Footprints Time Limit:1000MS     Memory Limit:262144KB     64bit IO F ...

  5. OUC_Summer Training_ DIV2_#2之解题策略 715

    这是第一天的CF,是的,我拖到了现在.恩忽视掉这个细节,其实这一篇只有一道题,因为这次一共做了3道题,只对了一道就是这一道,还有一道理解了的就是第一篇博客丑数那道,还有一道因为英语实在太拙计理解错了题 ...

  6. OUC_Summer Training_ DIV2_#7 718

    是18号做的题啦,现在才把报告补上是以前不重视报告的原因吧,不过现在真的很喜欢写报告,也希望能写一些有意义的东西出来. A - Dragons Time Limit:2000MS     Memory ...

  7. OUC_Summer Training_ DIV2_#11 722

    企鹅很忙系列~(可惜只会做3道题T_T) A - A Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d &am ...

  8. OUC_Summer Training_ DIV2_#9 719

    其实自己只会做很简单的题,有时都不想写解题报告,觉得不值得一写,但是又想到今后也许就不会做ACM了,能留下来的东西只有解题报告了,所以要好好写,很渣的题也要写,是今后的纪念. B - B Time L ...

  9. OUC_Summer Training_ DIV2_#5

    这是做的最好的一次了一共做了4道题  嘻嘻~ A - Game Outcome Time Limit:2000MS     Memory Limit:262144KB     64bit IO For ...

随机推荐

  1. vue滚动+滑动删除标记(移动端)仿qq/微信

    安装组件 "vue-touch": "^2.0.0-beta.4", main.js引入 import VueTouch from 'vue-touch' Vu ...

  2. kali安装开启ssh & 安装docker

    ssh相关 一.配置SSH参数 . 修改sshd_config文件,命令为: vi /etc/ssh/sshd_config 将#PasswordAuthentication no的注释去掉,并且将N ...

  3. ath6kl 架构

    转:http://blog.csdn.net/robertsong2004/article/details/38899415 AR600x软件被划分为主机端和目标端软件.主机端软件或驱动程序的代码被提 ...

  4. 7.Nginx_Keepalived高可用配置

    2. 利用keepalived实现高可靠配置(HA) 2.1. 高可靠概念 HA(High Available):高可用性集群,是保证业务连续性的有效解决方案,一般有两个或两个以上的节点,且分为活动节 ...

  5. HH的项链 HYSBZ - 1878 (莫队/ 树状数组)

    HH有一串由各种漂亮的贝壳组成的项链.HH相信不同的贝壳会带来好运,所以每次散步 完后,他都会随意取出一 段贝壳,思考它们所表达的含义.HH不断地收集新的贝壳,因此他的项链变得越来越长.有一天,他突然 ...

  6. CSS基础学习-10.CSS伸缩盒(老版本)

  7. CSS——字体大小最常用的单位

    px (像素): 将像素的值赋予给你的文本.这是一个绝对单位, 它导致了在任何情况下,页面上的文本所计算出来的像素值都是一样的. ems: 1em 等于我们设计的当前元素的父元素上设置的字体大小 (更 ...

  8. $y=\sin(\omega x)$平移到$y=\sin (\omega x+\varphi)$动态过程(交互式)

    可以拖动滑动条的\(\omega\)和\(\varphi\)看动态效果

  9. java poi 生成多个sheet

    我的需求是:在一个表格中生成多个sheet,每个sheet的名称动态指定,每个sheet内的内容动态指定.生成的文件名动态指定. 工具类: package test; import java.io.O ...

  10. 【Share Code | HTML & CSS & Javascript】动画片段幻灯片

    [查看demo & 下载资源](https://zhaoshuquan.com/posts/15 介绍 本文使用"Pieces"库轻松实现动画片段幻灯片效果. 今天我们想向 ...