這道題,也是字串匹配的問題,資料不大,估計暴力也可以,用時間要求是1000MS,KMP演算法15MS過的!給力!然後唯一不同的是,在模式串中不算有重疊的匹配串,只算一共有多少個不重疊的就好。要想最多,那很好辦,只要從頭挨著剪,就不會破壞其他的,比如aaaa,aa只要是從剪,就能剪出兩個,要是從中間開始,只能剪出一個。因此……見代碼:#include <cstdio>#include <cstring>const int N = 1010;char str[N], s[N]
Your mission, if you decide to accept it, is to create a maze drawing program. A maze will consist of the alphabetic charactersA-Z, * (asterisk), and spaces. Input and OutputYour program will get the information for the mazes from the input file.
Problem CA mid-summer night’s dreamInput:standard inputOutput:standard output This is year 2200AD. Science has progressed a lot in two hundred years. Two hundred years is mentioned here because this problem is being sent back to 2000AD with the help
連結:http://poj.org/problem?id=2481題目大意:給n個區間,對於兩個區間【Si,Ei】和【Sj, Ej】,如果Si <= Sj 且Ej <= Ei 且Ei - Si > Ej - Sj, 就說區間i比區間j“強大”。也就是區間i要嚴格包含區間j。求每個區間i,有多少個區間比i“強大”,並輸出。分析與總結:昨天的CF的B題Big
題目連結:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=113&page=show_problem&problem=1768原題:A grid that wraps both horizontally and vertically is called a torus. Given a torus where each cell contains an
連結:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=113&page=show_problem&problem=44原題:BackgroundA problem that is simple to solve in one dimension is often much more difficult to solve in more than one
題目連結:http://acm.hdu.edu.cn/showproblem.php?pid=2473原題:Problem DescriptionRecognizing junk mails is a tough task. The method used here consists of two steps:1) Extract the common characteristics from the incoming email.2) Use a filter matching the
連結:http://acm.hdu.edu.cn/showproblem.php?pid=1142題目:A Walk Through the ForestTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 3689 Accepted Submission(s): 1340Problem DescriptionJimmy