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进阶:vue-router之导航守卫、路由元信息、路由懒加载

    1.导航被触发 2.在失活的组件里调用离开守卫:beforeRouteLeave —— 组件内守卫(离开组件). 3.调用全局的beforeEach守卫 —— 全局守卫(进入组件). 4.在重用组件里 ...

  2. JSON parse error: syntax error, expect {, actual error, pos 0, fastjson-version 1.2.58; nested exception is com.alibaba.fastjson.JSONExcetion: syntax error, except {, actual error, pos ...

    这个报错信息告诉你,你提交的参数需要是json类型.所以,POST请求携带的数据需要序列化一下json.dumps(data).

  3. CNN for NLP

    卷积神经网络在自然语言处理任务中的应用.参考链接:Understanding Convolutional Neural Networks for NLP(2015.11) Instead of ima ...

  4. YII2.0.12兼容PHP7.2版本升级

    YII2.0.12兼容PHP7.2版本升级 报错信息: FastCGI sent in stderr: "PHP message: PHP Fatal error:  Cannot use ...

  5. netty-3.客户端与服务端通信

    (原) 第三篇,客户端与服务端通信 以下例子逻辑: 如果客户端连上服务端,服务端控制台就显示,XXX个客户端地址连接上线. 第一个客户端连接成功后,客户端控制台不显示信息,再有其它客户端再连接上线,则 ...

  6. WPF界面开发:DevExpress WPF在GridControl中固定行时处理时刻

    DevExpress广泛应用于ECM企业内容管理. 成本管控.进程监督.生产调度,在企业/政务信息化管理中占据一席重要之地.通过DevExpress WPF Controls,您能创建有着强大互动功能 ...

  7. php类知识---最疯狂的魔术方法serialize,_sleep,__wakeup,unserialize,__autoload,__clone

    serialize-----把实例化的对象写入文件 __sleep 调用serialize时触发 <?php class mycoach { public function __construc ...

  8. SpringBoot对接收及返回Instant类型的处理(转)

    一:处理post请求json中的Instant类型1.springboot中日期格式化配置: spring: jackson: date-format: yyyy-MM-dd HH:mm:ss tim ...

  9. ML paper 导图笔记.md

    <Learning Structured Representation for Text Classification via Reinforcement Learning> <基于 ...

  10. [Algorithm] Convert a number from decimal to binary

    125, how to conver to binary number? function DecimalToDinary (n) { let temp = n; let list = []; if ...