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(串)的更多相关文章

  1. Blue Jeans(串)

    Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10083   Accepted: 4262 Description The ...

  2. POJ 3080 Blue Jeans(串)

    题目网址:http://poj.org/problem?id=3080 思路: 以第一个DNA序列s为参考序列,开始做以下的操作. 1.将一个字母s[i]作为匹配串.(i为当前遍历到的下标) 2.遍历 ...

  3. POJ 3080 Blue Jeans(Java暴力)

    Blue Jeans [题目链接]Blue Jeans [题目类型]Java暴力 &题意: 就是求k个长度为60的字符串的最长连续公共子串,2<=k<=10 规定: 1. 最长公共 ...

  4. poj3080 Blue Jeans【KMP】【暴力】

    Blue Jeans Time Limit: 1000MS   Memory Limit: 65536K Total Submissions:21746   Accepted: 9653 Descri ...

  5. (字符串 KMP)Blue Jeans -- POJ -- 3080:

    链接: http://poj.org/problem?id=3080 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=88230#probl ...

  6. POJ 3080 Blue Jeans 找最长公共子串(暴力模拟+KMP匹配)

    Blue Jeans Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20966   Accepted: 9279 Descr ...

  7. POJ Blue Jeans [枚举+KMP]

    传送门 F - Blue Jeans Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u ...

  8. POJ 3080 Blue Jeans (求最长公共字符串)

    POJ 3080 Blue Jeans (求最长公共字符串) Description The Genographic Project is a research partnership between ...

  9. poj 3080 Blue Jeans

    点击打开链接 Blue Jeans Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 10243   Accepted: 434 ...

  10. POJ3080——Blue Jeans(暴力+字符串匹配)

    Blue Jeans DescriptionThe Genographic Project is a research partnership between IBM and The National ...

随机推荐

  1. HDU_Reward_拓扑排序

    Reward Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Subm ...

  2. CDR X8图框精确剪裁在哪?

    对于CorelDRAW,刚从低版本升级为高版本的同学可能一下子理不清方向,因为在CorelDRAW X8中有很多功能命令做了整改和位置的变化.很多用户反映,CDR中的图框精确剪裁不见了,然而并不是该命 ...

  3. AcGePoint3d ads_point 转换

    AcGePoint3d (AcGePoint2d )转换 ads_point 用:asDblArray函数. ads_point 转换AcGePoint2d  用asPnt2d(const doubl ...

  4. C#当中的out关键字(借鉴于CSDN)

    一丶与ref关键字一样,out关键字也是按引用来传递的.out 关键字会导致参数通过引用来传递.这与 ref 关键字类似,不同之处在于 ref 要求变量必须在传递之前进行初始化.若要使用 out 参数 ...

  5. 本地读取服务器Xml文件及本地读本地的xml

    updateUrl="ServerUrl"(服务器路径) WebClient wc = new WebClient(); Stream stream = wc.OpenRead(u ...

  6. Self-Attetion

    四.self-attention 1.是什么? attention机制通常用在encode与decode之间,但是self-attention则是输入序列与输出序列相同,寻找序列内部元素的关系即 K= ...

  7. NOIWC2019 冬眠记

    冬眠 由于THUWC考太差了没啥心情做事…… Day -1 报到日前一天晚上去看了看宿舍表,发现周围全是集训队,隔壁就是栋爷.高队和lca,再隔壁是zzq和wxh……吓傻了(本校buff这么好吗) D ...

  8. 关于python字符串format的一些花式用法

    目录: 基础 实战 前提: python中字符串的format功能非常强大,可以说完全能够替代其他的字符串使用方法,但是在后期的项目开发中使用的并不是特别的多, 以至于想用的时候会想不起来准确的使用方 ...

  9. 【codeforces 701C】They Are Everywhere

    [题目链接]:http://codeforces.com/contest/701/problem/C [题意] 让你选择一段最短的区间; 使得这段区间里面包含所有种类的字符; [题解] 之前都是用二分 ...

  10. qwb与小数

    qwb与小数 Time Limit: 1 Sec  Memory Limit: 128 MB Description qwb遇到了一个问题:将分数a/b化为小数后,小数点后第n位的数字是多少? 做了那 ...