HDU5311】的更多相关文章

Problem Description Today is the 1st anniversary of BestCoder. Soda, the contest manager, gets a string s of length n. He wants to find three nonoverlapping substrings s[l1..r1], s[l2..r2], s[l3..r3] that: 1. 1≤l1≤r1<l2≤r2<l3≤r3≤n 2. The concatenati…
题意:给一个指定的字符串a,要求分成三段,然后再给定另外一个字符串b,要求a中的三段能否在b中找到. 思路:枚举+模拟,首先枚举给定的字符串a,因为分成三段,所以一共有(1+9)*9/2种情况,对于分成后的三段p,q,r先查找p在b中匹配后的下标,然后减去b,结果是匹配字符的前一个下标,所以这个时候要加上匹配的长度,才能确定下个匹配从哪里开始,最后只要匹配成功即可退出. #include<cstring> #include<stdio.h> #include<iostream…
Hidden String Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 1679    Accepted Submission(s): 591 Problem Description Today is the 1st anniversary of BestCoder. Soda, the contest manager, get…
最近做题遇到分割与匹配字符串的题目(hdu5311),看来别人的代码,才知道有strncpy()和strstr()函数,于是搜集了一点资料,记录一下基本用法. 一.strncpy() char * strncpy ( char * destination, const char * source, size_t num ); strncpy() 在 <string.h>头文件中(C++中为<cstring>),拷贝原字符串S中长度为num的部分至目标字符串D中. #include…