UVALive 6659 Dromicpalin Substrings 枚举判断
来源:互联网 发布:淘宝图片上传大小 编辑:程序博客网 时间:2024/04/29 11:53
枚举每个位置为起点,然后判断有多少个为奇数的字母,为奇数的<=1这个区间可以变成回文串。ans++
#include<iostream>#include<cstring>#include<algorithm>#include<cstdio>using namespace std;int num[200];char word[2000];int main(){ int n,tt=1; scanf("%d",&n); while(n--){ int ans = 0; scanf("%s",word); int len = strlen(word); for(int i = 0;i < len; i++){ memset(num,0,sizeof(num)); int res = 0; for(int j = i;j < len; j++){ num[word[j]]++; if(num[word[j]] & 1) res++; else res--; if(res <= 1) ans++; } } printf("Case %d: %d\n",tt++,ans); } return 0;}/*4 acmicpc*/
0 0
- UVALive 6659 Dromicpalin Substrings 枚举判断
- UVALive 6659 Dromicpalin Substrings
- UVALive 6659 Dromicpalin Substrings (递推 + 暴力枚举)
- Dromicpalin Substrings
- UVA 12718 Dromicpalin Substrings
- UVA 12718 Dromicpalin Substrings
- HDU1238:Substrings(暴力枚举)
- UVA 12718 Dromicpalin Substrings(寻找字符串连续子串的回文)
- UVALive 6869 Repeated Substrings(后缀数组)
- POJ 1226 Substrings(KMP+枚举)
- NEFU 721 Substrings exp 枚举
- hdu 1238 Substrings(暴力枚举)
- 【枚举情况】UVALive
- UVAlive 4975 Manacher+枚举
- POJ 1226 Substrings 暴力枚举+KMP算法
- codeforces 451D Count Good Substrings 枚举
- hdu 1238 Substrings (暴搜,枚举)
- poj Substrings 1226 (KMP&&枚举)
- 进职场记(二)-培训
- A-B
- 简易nagios安装出现的问题及解决方法
- 通信方式详解,无名管道pipe,有名管道fifo,共享内存share memory,消息队列msg
- iOS 多线程(三)NSOperation
- UVALive 6659 Dromicpalin Substrings 枚举判断
- ListView
- MongoDB学习七--MongoDB的Map-Reduce示例
- Ftp上传下载文件,并能自定义进度条展示(FtpClient)
- properties文件的使用
- POJ3734Blocks矩阵快速幂加dp思想
- Linux创始人畅谈开源操作系统
- 浅析 RTTI机制
- jQuery全选、反选、全不选