poj 3080 Blue Jeans (多串最长公共子串 暴力)
来源:互联网 发布:管家婆普及版数据恢复 编辑:程序博客网 时间:2024/06/05 19:04
#include<cstdio>#include<cstring>char str[20][101];char key[160];char miao[106];int main(){int t;scanf("%d",&t);while(t--){int n;scanf("%d",&n);memset(miao,0,sizeof(miao));for(int i=0;i<n;i++)scanf("%s",str[i]);int ans=0;for(int i=0;str[0][i]!='\0';i++){for(int j=i,m=0;str[0][j]!='\0';j++,m++){key[m]=str[0][j];key[j+1-i]=0;int cnt=0;for(int k=1;k<n;k++){if(strstr(str[k],key)){cnt++;continue;}break;}if(cnt==n-1){if(j+1-i>=3&&j+1-i>=ans){if(strlen(miao)==0||ans<j+1-i)strcpy(miao,key);if(ans==j+1-i&&strcmp(miao,key)>0)strcpy(miao,key);ans=j+1-i;}}}}if(ans<3){printf("no significant commonalities\n");}else{printf("%s\n",miao);}}return 0;}
0 0
- poj 3080 Blue Jeans (多串最长公共子串 暴力)
- poj 3080 Blue Jeans (KMP+最长公共子串)
- poj 3080 Blue Jeans(最长公共子串)
- POJ 3080 Blue Jeans(KMP 最长公共子串)
- POJ 3080 Blue Jeans(KMP 最长公共子串)
- POJ 3080 Blue Jeans【多串最长子串】
- POJ3080 Blue Jeans 最长公共子串
- POJ 3080/ ZOJ 2784 : Blue Jeans - 串匹配,最长公共子串
- POJ 3080:Blue Jeans:枚举求解n个字符串的最长公共连续子串
- [poj 3080]Blue Jeans[暴力枚举子串]
- POJ 3080 Blue Jeans(KMP:最长连续公共子序列)
- poj 3080 Blue Jeans【KMP】【求公共子串】
- poj-3080-Blue Jeans-串-暴力
- POJ 3080 Blue Jeans 串的暴力
- POJ 3080 Blue Jeans(暴力 + 串)
- POJ3080 Blue Jeans(KMP,求最长公共子串)
- Poj 3080 Blue Jeans + Hdu 2328 Corporate Identity (后缀数组 字典序最小的最长公共子串)
- poj 3080 Blue Jeans 暴力
- 迷宫BFS+递归回溯找爹打印路径
- hihoCoder 二分·二分查找之k小数
- HDU 4114 Disney's FastPass(状压dp)
- 迷宫DFS
- 路由事件初级案例
- poj 3080 Blue Jeans (多串最长公共子串 暴力)
- IIS7.5 错误代码0x8007007e HTTP 错误 500.19
- Androidapi.JNI.Net.Wifi
- 容器第八课,数据存储综合练习,javabean的介绍
- Ibatis学习笔记
- Android_SDCard 的读写权限设置
- 规则 3.2:变量命名汇总表
- java学习之多线程
- Java HashMap的工作原理