HDU 2736 Surprising Strings】的更多相关文章

                                Surprising Strings Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u   Description The D-pairs of a string of letters are the ordered pairs of letters that are distance D from each other. A s…
重点在判重的方法,嘻嘻 题目 #define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<string.h> int main() { ],num,flag; ]; while(gets(ch)) { )break; len=strlen(ch); flag=; ;i<len;i++) { memset(mark,,sizeof(mark)); ;j<len-i;j++) { num=(ch[j]-)*+ch[j…
Surprising Strings Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 294    Accepted Submission(s): 209 Problem Description The D-pairs of a string of letters are the ordered pairs of letters tha…
[POJ3096]Surprising Strings 试题描述 The D-pairs of a string of letters are the ordered pairs of letters that are distance D from each other. A string is D-unique if all of its D-pairs are different. A string is surprising if it is D-unique for every pos…
                               C - Surprising Strings 题意:输入一段字符串,假设在同一距离下有两个字符串同样输出Not surprising ,否则输出surprising. Description The D-pairs of a string of letters are the ordered pairs of letters that are distance D from each other. A string is D-uniq…
Surprising Strings Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5081   Accepted: 3336 Description The D-pairs of a string of letters are the ordered pairs of letters that are distance D from each other. A string is D-unique if all of…
Surprising Strings Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6193   Accepted: 4036 Description The D-pairs of a string of letters are the ordered pairs of letters that are distance D from each other. A string is D-unique if all of…
Surprising Strings Time Limit: 1000MS Memory Limit: 65536K Total Submissions: Accepted: Description The D-pairs of a string of letters are the ordered pairs of letters that are distance D from each other. A string is D-unique if all of its D-pairs ar…
Surprising Strings Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 5783   Accepted: 3792 Description The D-pairs of a string of letters are the ordered pairs of letters that are distance D from each other. A string is D-unique if all of…
/* HDU 6170 - Two strings [ DP ] | 2017 ZJUT Multi-University Training 9 题意: 定义*可以匹配任意长度,.可以匹配任意字符,问两串是否匹配 分析: dp[i][j] 代表B[i] 到 A[j]全部匹配 然后根据三种匹配类型分类讨论,可以从i推到i+1 复杂度O(n^2) */ #include <bits/stdc++.h> using namespace std; const int N = 2505; int t;…
Surprising Strings Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6258   Accepted: 4072 Description The D-pairs of a string of letters are the ordered pairs of letters that are distance D from each other. A string is D-unique if all of…
题目:http://poj.org/problem?id=3096 题意:给定一个字符串S,从中找出所有有两个字符组成的子串,每当组成子串的字符之间隔着n字符时,如果没有相同的子串出现,则输出 "S is surprising." , 反之,则输出 "S is NOT surprising." . 例如 AABA 把它分成两个字符为一个整体的,1..相邻两个字符 AA,AB,BA 没有相同的;    2.隔一个字符的 AB AA 没有相同;          3.隔…
http://poj.org/problem?id=3096 题意容易理解,开始直接暴力,还是用map写下吧,熟练一下: #include<stdio.h> #include<string.h> #include<string> #include<map> using namespace std; int main() { ]; ]; int n,i; map <string,int> mymap; while(~scanf("%s&q…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6170 题意:给了2个字符串,其中第2个字符串包含.和*两种特别字符,问第二个字符串能否和第一个匹配. 解法:dp[i][j]代表在第一个串的i位置,第2个串的j位置是否可以匹配,然后按照'*'这个特殊情况讨论转移即可. #include <bits/stdc++.h> using namespace std; const int maxn = 3005; bool dp[maxn][maxn];…
Two strings Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Problem Description Giving two strings and you should judge if they are matched.The first string contains lowercase letters and uppercase letters.The seco…
http://poj.org/problem?id=3096 for循环真是奇妙! #include <string.h> #include <stdio.h> #include <string> #include <map> using namespace std; int main() { ],st[]; int l,flag; while(scanf("%s",a)!=EOF) { ]=='*') break; l=strlen(a…
题目链接 Problem Description Giving two strings and you should judge if they are matched. The first string contains lowercase letters and uppercase letters. The second string contains lowercase letters, uppercase letters, and special symbols: "." an…
/** * 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6170 * 字符串match, '.'代表匹配任意一个字符,"*" 代表前面的那个字符可以重复 * 出现0到无穷次. * * 思路: dp[i][j];代表前i个字符与另一个前j个字符是否能匹配? true:false: * 假设i是B串,j是A串 * 如果是:不是*,那就直接判断相等或者其中一个是否为点.是进行转移 dp[i][j]=dp[i-1][j-1]; * 如果是*,我…
http://acm.hdu.edu.cn/showproblem.php?pid=6170 题目大意: 给出两个字符串s1和s2(长度小于等于2500). s1是一个正常的包含大小写字母的字符串,s2是一个类似正则表达式的字符串,除了大小写字母,还有 " . " 和 " * " 两种符号. " . " 表示可以匹配任意一个字母. " * "表示前一个字符可以重复出现任意次(包括零). 解题思路: 一道标准的dp O(n^2)…
传送门 Average distance Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 682    Accepted Submission(s): 244Special Judge Problem Description Given a tree, calculate the average distance between two…
题意: t组输入,每组数据输入一个整数n,代表字符串长度.下面再输入一个字符串 你需要判断这个字符串能不能分成大于1段,且这些段的最小表示法是一样的 例如:abccab,它可以分成2段,分别是abc和cab,它们都使用最小表示法(也就是字典序最小表示)表示之后都是abc,所以这两个串一样 题解: 因为你需要把字符串分成若干段,假设分成x段,那么x肯定满足n%x==0 这里就有两种方法,第一种就是枚举n的因子,然后再暴力去判断这个因子可不可以 另一种就是:假如存在一个可以满足题意的因子x(也就是说…
题意:输入很多字符串,以星号结束.判断每个字符串是不是“Surprising Strings”,判断方法是:以“ZGBG”为例,“0-pairs”是ZG,GB,BG,这三个子串不相同,所以是“0-unique”,“1-pairs”是ZB,GG,这两个也是不同的,所以是“1-unique”,“2-pairs”是ZG,所以是“2-unique”:综合起来是“Surprising Strings”. 思路:用map就可以,做的时候手欠用了暴搜,结果发现竟然0ms过了,不科学.而用map花了16ms非常…
各种杂题,水题,模拟,包括简单数论. 1001 A+B 1002 A+B+C 1009 Fat Cat 1010 The Angle 1011 Unix ls 1012 Decoding Task 1019 Grandpa's Other Estate 1034 Simple Arithmetics 1036 Complete the sequence! 1043 Maya Calendar 1054 Game Prediction 1057 Mileage Bank 1067 Rails 10…
A - Surprising Strings 题意就是给你一个字符串,例如ZGBG,有一种称谓叫D-unique 这个字符串 在D=0时, 有三个子串 ZG GB BG,因为这三个都不同,也就是unique,所以ZGGB是 0-unique: 同理               D=1时,有两个子串ZB GG也是不同,所以ZGGB是 1-unique: D=2时,只有一个子串ZG,独一无二,所以ZGGB是 2-unique: ince these three pairs are all diffe…
C++的标准模版库的应用 Surprising Strings Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6625   Accepted: 4309 Description The D-pairs of a string of letters are the ordered pairs of letters that are distance D from each other. A string is D-uniq…
Surprising Strings Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7659   Accepted: 4878 Description The D-pairs of a string of letters are the ordered pairs of letters that are distance D from each other. A string is D-unique if all of…
hdu 6208 The Dominator of Strings[AC自动机] 求一个串包含其他所有串,找出最长串去匹配即可,但是匹配时要对走过的结点标记,不然T死QAQ,,扎心了.. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<queue> using namespace std; inline )+=c-';} ; ;…
The Dominator of Strings Time Limit: 3000/3000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 2830    Accepted Submission(s): 1010 Problem Description Here you have a set of strings. A dominator is a string of the…
题目链接 Problem Description Giving two strings and you should judge if they are matched.The first string contains lowercase letters and uppercase letters.The second string contains lowercase letters, uppercase letters, and special symbols: “.” and “*”..…
What Are You Talking About Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 102400/204800 K (Java/Others) Total Submission(s): 15966    Accepted Submission(s): 5177 Problem Description Ignatius is so lucky that he met a Martian yesterday. But…