UVA 12718 Dromicpalin Substrings
2014-08-07 15:04
232 查看
个人赛第四场。记录一下这道就我一个人没做出的大水题吧。说实话一开始就想到了正确方法,但是到了最后还是不敢往这个方向敲,总怕超时。当做给自己的教训吧,勇于尝试,并且,永不放弃。
题意:求所给字符串连续子串回文(可以乱序)的数量。
题目链接:uva 12718
题意:求所给字符串连续子串回文(可以乱序)的数量。
题目链接:uva 12718
#include<stdio.h> #include<string.h> int main() { int t; while(scanf("%d",&t)!=EOF) { char a[1005]; int cnt[30]; int i,j,k,z; int len; int ans; int count; count=0; for(i=1;i<=t;++i) { scanf("%s",a); len=strlen(a); count=0; for(j=0;j<len;++j) { memset(cnt,0,sizeof(cnt)); for(z=j;z<len;++z) { cnt[a[z]-'a']++; ans=0; for(k=0;k<26;++k) { if(cnt[k]%2==1) { if(ans) break; else ans=1; } } if(k==26) count++; } } printf("Case %d: %d\n",i,count); } } return 0; }
相关文章推荐
- UVa 12718 Dromicpalin Substrings (暴力)
- UVA 12718 Dromicpalin Substrings(寻找字符串连续子串的回文)
- UVA 12718 Dromicpalin Substrings
- UVALive 6659 Dromicpalin Substrings 枚举判断
- UVALive 6659 Dromicpalin Substrings (递推 + 暴力枚举)
- UVALive 6659 Dromicpalin Substrings
- Dromicpalin Substrings
- uva10829 - L-Gap Substrings 后缀数组+RMQ
- UVa 10829 - L-Gap Substrings (后缀数组)
- UVA 10829 L-Gap Substrings (后缀数组+RMQ)
- 【UVA10829】 L-Gap Substrings (后缀数组)
- UVA 10829 L-Gap Substrings 后缀数组
- UVA 12718 K - L2
- UVA 10829 L-Gap Substrings(后缀数组+枚举区间优化)
- UVA 10829 L-Gap Substrings(后缀数组)
- uva10829 L-Gap Substrings
- UVA 10829 - L-Gap Substrings(后缀数组)
- uva10829 L-Gap Substrings
- uva 10829 - L-Gap Substrings(后缀数组)
- UVa 10829 L-Gap Substrings (后缀数组+rmq)