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个字符,求所有字符串中都出现过的最长公共子序列,若该子序列 ...
随机推荐
- Object-C - 类的定义
http://www.cnblogs.com/zhangweia/archive/2011/11/01/2231549.html 1. 文件分为.h:定义接口,及其属性,方法说明. .m :是实现类. ...
- 解决 Chrome 浏览器自动调整小于11px字体的问题
不知道说是 Chrome 智能呢?还是说它多此一举?Chrome 浏览器中存在默认会自动将小于11px大小的字体调整为12px.我在写 BlueNight 主题的最新评论时候就设置了评论发布时间为11 ...
- GridView分页排序
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="GridviewPage.asp ...
- Spark Tungsten揭秘 Day4 内存和CPU优化使用
Spark Tungsten揭秘 Day4 内存和CPU优化使用 今天聚焦于内存和CPU的优化使用,这是Spark2.0提供的关于执行时的非常大的优化部分. 对过去的代码研究,我们会发现,抽象的提高, ...
- Mysql 如何删除数据表中的重复数据!
1.使用distinct查询所有不重复的记录 2.创建数据表相同结构的临时表,将第一步的数据复制进去 create temporary table if not exists student_temp ...
- 解决未能从程序集xxx中加载类型System.ServiceModel.Activation.HttpModule的问题
在IIS中运行网站时,出现错误: 未能从程序集“System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c ...
- ios app - 打开系统设置URL
ios --- 调用系统"设置"里的功能(转) 安装后第一次运行软件时,系统会弹出提示用户是否允许软件获取当前位置,如果用户不允许的话,之后运行时系统不会在弹出提示设置,这点很不方 ...
- linux内核分析之内存管理
1.struct page /* Each physical page in the system has a struct page associated with * it to keep tra ...
- What we learned in Seoul with AlphaGo
What we learned in Seoul with AlphaGo March 16, 2016 Go isn’t just a game—it’s a living, breathing c ...
- js学习之函数表达式及闭包
来自<javascript高级程序设计 第三版:作者Nicholas C. Zakas>的学习笔记(七) 直接切入主题~ 定义函数的方式有两种: 函数声明 function functio ...