Blue Jeans(串)
http://poj.org/problem?id=3080
寻找最长公共子串。。暴搜的。。
#include<stdio.h>
#include<string.h>
int main()
{
int t,n;
char s[][],ss[],str[];
scanf("%d",&t);
while(t--)
{
scanf("%d%*c",&n);
int i,j,k;
for (i = ; i < n; i ++)
{
scanf("%s",s[i]);
}
int max_len = ;
for (i = ; i < ; i ++)
{
for (j = i; j < ; j ++)
{
int t = ;
for (k = i; k <= j; k ++)
{
ss[t++] = s[][k];
}
ss[t] = '\0';
for (k = ; k <= n; k ++)
{
if (strstr(s[k],ss)==NULL) break;
}
if (k==n && t > max_len)
{
max_len = t;
strcpy(str,ss);
}
else if (k==n && t==max_len)
{
if (strcmp(str,ss)>)
strcpy(str,ss);
}
}
}
if (max_len < )
printf("no significant commonalities\n");
else
printf("%s\n",str);
}
return ;
}
Blue Jeans(串)的更多相关文章
- Blue Jeans(串)
Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10083 Accepted: 4262 Description The ...
- POJ 3080 Blue Jeans(串)
题目网址:http://poj.org/problem?id=3080 思路: 以第一个DNA序列s为参考序列,开始做以下的操作. 1.将一个字母s[i]作为匹配串.(i为当前遍历到的下标) 2.遍历 ...
- POJ 3080 Blue Jeans(Java暴力)
Blue Jeans [题目链接]Blue Jeans [题目类型]Java暴力 &题意: 就是求k个长度为60的字符串的最长连续公共子串,2<=k<=10 规定: 1. 最长公共 ...
- poj3080 Blue Jeans【KMP】【暴力】
Blue Jeans Time Limit: 1000MS Memory Limit: 65536K Total Submissions:21746 Accepted: 9653 Descri ...
- (字符串 KMP)Blue Jeans -- POJ -- 3080:
链接: http://poj.org/problem?id=3080 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=88230#probl ...
- POJ 3080 Blue Jeans 找最长公共子串(暴力模拟+KMP匹配)
Blue Jeans Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20966 Accepted: 9279 Descr ...
- POJ Blue Jeans [枚举+KMP]
传送门 F - Blue Jeans Time Limit:1000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u ...
- 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 ...
- POJ3080——Blue Jeans(暴力+字符串匹配)
Blue Jeans DescriptionThe Genographic Project is a research partnership between IBM and The National ...
随机推荐
- iOS错误报告中关于崩溃地址的分析
http://blog.csdn.net/gaoyp/article/details/46912753 一.错误报告中的三种地址:stack addressload addresssymbol add ...
- linux安装mysql可视化工具MySQL-workbench 连接数据库 执行sql
Step1:建立数据库连接 点击新建连接的按钮,符号是“+”的按钮,出现下图,在“Connection name”输入连接名称. 填写连接信息 输入数据库连接密码 测试连接: 再次点击连接时会要求输入 ...
- lsof command not found 解决
有些centos 没有 lsof命令,需要安装 yum install lsof -y 使用: lsof -i:端口号
- ESLint =》tslint.json
结论:将ESLint提示注意()里面的规则属性在tslint.json中"rules": { } 里设置为false 1.ES6: ESLint提示"Require Ob ...
- leetcode刷题记录--js
leetcode刷题记录 两数之和 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数,并返回他们的数组下标. 你可以假设每种输入只会对应一个答案.但 ...
- 2.Linux的用户、用户组、权限、文件系统管理及其网络配置
2.1 Linux的用户及用户组 2.1.1 Linux的用户管理 用户账号管理包含以下三个方面: 用户账号的添加.删除.与修改 用户口令(密码)的管理 用户组的添加.删除管理 Linux系统中用户信 ...
- 阅读《JavaScript设计模式》第二章心得
面向对象编程 面向对象编程就是将你的需求抽象成一个对象.然后针对这个对象分析其特征(属性)与动作(方法).这个对象我们称之为类.面向对象编程思想其中的一个特点就是封装. 1.私有属性.私有方法.特权方 ...
- C++字符串处理函数
#include<iostream> #include<stdlib.h> #include<string> #include <assert.h> u ...
- Drop all tables in MySQL database
Drop all tables in MySQL database Answer: MySQL does not have a command for removing all database ta ...
- [bzoj3207]花神的嘲讽计划Ⅰ[可持久化线段树,hash]
将每k个数字求一个哈希值,存入可持久化线段树,直接查询即可 #include <iostream> #include <algorithm> #include <cstd ...