hdu-2328(暴力枚举+kmp)】的更多相关文章

Beautiful Now Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1876    Accepted Submission(s): 707 Problem Description Anton has a positive integer n, however, it quite looks like a mess, so he…
题意:给你n个字符串,问你这n个串的最长公共子串 解题思路:暴力枚举任意一个字符串的所有子串,然后暴力匹配,和hdu1238差不多的思路吧,这里用string解决的: 代码: #include<iostream> #include<string> #include<cstdio> #include<algorithm> using namespace std; string t; int main() { int n; string a[4050]; ios…
题目链接:  HDU http://acm.hdu.edu.cn/showproblem.php?pid=2328 POJhttp://poj.org/problem?id=3450 #include<iostream> #include<cstring> #include<string> #include<cstdio> using namespace std; const int maxn=4444; char x[222],ans[222]; char…
Problem Description Beside other services, ACM helps companies to clearly state their “corporate identity”, which includes company logo but also other signs, like trademarks. One of such companies is Internet Building Masters (IBM), which has recentl…
题目链接:https://vjudge.net/problem/POJ-3080 Blue Jeans Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 19152   Accepted: 8524 Description The Genographic Project is a research partnership between IBM and The National Geographic Society that…
#include <cstdio> #include <cstring> #include <iostream> #include <cmath> #include <algorithm> #include <queue> #include <vector> using namespace std; ; ; const int INF = 0x3f3f3f; char G[maxn][maxn]; bool vis[max…
Reversi Time Limit: 5000/2000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1226    Accepted Submission(s): 258 Problem Description Reversi, also called Othello, is a two-sided game.Each of the two sides correspon…
题目链接:hdu_2328_Corporate Identity 题意: 给你n个串,让你找这n个串的最大公共子串 题解: 串比较小,暴力枚举第一个的子串,然后KMP判断是否可行 #include<cstdio> #include<cstring> #define F(i,a,b) for(int i=a;i<=b;i++) ; ],ans,l,r,cnt; ][N]; int KMP(int n,char*a,int m,char*b){ int i,j; ]=j=-,i=…
HDU 6638 - Snowy Smile 题意 给你\(n\)个点的坐标\((x,\ y)\)和对应的权值\(w\),让你找到一个矩形,使这个矩阵里面点的权值总和最大. 思路 先离散化纵坐标\(y\)的值 对\(n\)个点根据横坐标\(s\)进行排序 枚举横坐标,按顺序把点扔到线段树里,以离散化后\(y\)的\(id\)为下标\(pos\),存到线段树里 因为线段树可以在\(\log{n}\)的时间内插入数值,在\(O(1)\)的时间内查询当前区间最大子段和(线段树区间合并) \(node[…
题目 这是一道可以暴力枚举的水题. //以下两个都可以ac,其实差不多一样,呵呵 //1: //4 wei shu #include<stdio.h> struct tt { ],b[],c[]; }e[]; int main() { ],mark[],yi,flag,a1,a2,a3,a4; while(scanf("%d",&n),n) { ;i<n;i++) { scanf("%s%s%s",e[i].a,e[i].b,e[i].c)…