poj 3080 Blue Jeans(水题 暴搜)
题目:http://poj.org/problem?id=3080
水题,暴搜
#include <iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<stack>
#include<queue>
#include<iomanip>
#include<cmath>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int t,i,j,k,n,f,cnt;
char s[][],a[],b[];
cin>>t;
while(t--)
{
f=; memset(b,,sizeof(b)); b[]='\0';
cin>>n;
getchar();
for(i=; i<n; i++)
cin>>s[i];
for(i=; i<; i++)
{
for(j=i+; j<; j++)
{
cnt=; memset(a,,sizeof(a));
for(k=i; k<=j; k++)
a[cnt++]=s[][k];
a[k]='\0';
for(k=; k<n; k++)
{
if(strstr(s[k],a)==NULL)
break;
if(k==n-)
{
f=;
if(strlen(a)>strlen(b))
strcpy(b,a);
if(strlen(a)==strlen(b)&&strcmp(a,b)<)
strcpy(b,a);
}
}
}
} if(f==) cout<<"no significant commonalities"<<endl;
else cout<<b<<endl;
}
return ;
}
poj 3080 Blue Jeans(水题 暴搜)的更多相关文章
- POJ 3080 Blue Jeans (求最长公共字符串)
POJ 3080 Blue Jeans (求最长公共字符串) Description The Genographic Project is a research partnership between ...
- poj 3080 Blue Jeans
点击打开链接 Blue Jeans Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10243 Accepted: 434 ...
- POJ 3080 Blue Jeans (字符串处理暴力枚举)
Blue Jeans Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 21078 Accepted: ...
- POJ 3080 Blue Jeans(Java暴力)
Blue Jeans [题目链接]Blue Jeans [题目类型]Java暴力 &题意: 就是求k个长度为60的字符串的最长连续公共子串,2<=k<=10 规定: 1. 最长公共 ...
- POJ 3080 Blue Jeans 找最长公共子串(暴力模拟+KMP匹配)
Blue Jeans Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20966 Accepted: 9279 Descr ...
- poj 3080 Blue Jeans 解题报告
题目链接:http://poj.org/problem?id=3080 该题属于字符串处理中的串模式匹配问题.题目要求我们:给出一个DNA碱基序列,输出最长的相同的碱基子序列.(保证在所有的序列中都有 ...
- POJ 3080 Blue Jeans、POJ 3461 Oulipo——KMP应用
题目:POJ3080 http://poj.org/problem?id=3080 题意:对于输入的文本串,输出最长的公共子串,如果长度相同,输出字典序最小的. 这题数据量很小,用暴力也是16ms,用 ...
- POJ 3080 Blue Jeans(后缀数组+二分答案)
[题目链接] http://poj.org/problem?id=3080 [题目大意] 求k个串的最长公共子串,如果存在多个则输出字典序最小,如果长度小于3则判断查找失败. [题解] 将所有字符串通 ...
- POJ 3080 Blue Jeans 后缀数组, 高度数组 难度:1
题目 http://poj.org/problem?id=3080 题意 有m个(2<=m<=10)不包含空格的字符串,长度为60个字符,求所有字符串中都出现过的最长公共子序列,若该子序列 ...
随机推荐
- mysql_sql语句之美
无线地址及数量统计 单个用户无线登录信息统计
- 概念:RPG与RPGLE的区别
RPG是OPM编程模式,即RPG编程的代码不能编译成*MODULE:编译只能直接生成一个程序,*PGM. RPGLE是ILE编程模式.OS/400环境下,ILE是集成开发环境.在ILE环境下,所 ...
- C++数据类型总结
关键字:C++, 数据类型, VS2015. OS:Windows 10. ANSI C/C++基本数据类型: Type Size 数值范围 无值型void 0 byte 无值域 布尔型bool 1 ...
- PhantomJS实现最简单的模拟登录方案
以前写爬虫,遇到需要登录的页面,一般都是通过chrome的检查元素,查看登录需要的参数和加密方法,如果网站的加密非常复杂,例如登录qq的,就会很蛋疼 在后面,有了Pyv8,就可以把加密的js文件扔给它 ...
- 在cmd命令行下登录本地oracle数据库与服务器上的oracle
一.本地登录 cmd->sqlplus 用户名/密码@数据库名 (as sysdba)->enter注:如果此用户名不是系统用户sys,scott,system就不需要加as sysdba ...
- C# DateTime和DateTime?格式化时间
DateTime: <%= Model.CreateTime.ToString("yyyy年MM月dd日 H时m分s秒")%> DateTime?: <%= ...
- iOS sqlite 增删改查 简单封装(基于 FMDB)
/** * 对 sqlite 的使用进行简单封装,仅涉及简单的单表 增删改查 * * 基于 FMDB * * 操作基于 model ,数据库表字段与 model 属性一一对应,对 model 整 ...
- UINavigationController 总结
一 . UINavigationBar 1.获取 UINavigationBar 对象: [UINavigationBar appearance] ,可以通过该方法对全部 navigation 进行设 ...
- 839. Optimal Marks - SPOJ
You are given an undirected graph G(V, E). Each vertex has a mark which is an integer from the range ...
- [转载]C#中播放背景音乐几种的方法
最经在写winform程序,其中有用到播放背景音乐 特此收集了一些网上的教程: 1.调用非托管的dll using System.Runtime.InteropServices; //DllImpor ...