HDU 6264 Super-palindrome
http://acm.hdu.edu.cn/downloads/CCPC2018-Hangzhou-ProblemSet.pdf
#include<bits/stdc++.h> using namespace std; #define ll long longconst int inf = 0x3f3f3f3f; const int mod = 1000000007; const int maxn = 10000 + 8;int t, num; string s; map<char, int>mp, np;int main() {scanf("%d", &t);while(t--){mp.clear();np.clear();cin >> s;int len = s.size(), maxx1 = 0, maxx2 = 1, sum1= 0, sum2 = 0;for(int i = 0; i < len; i++){if(i % 2){if(!mp[s[i]])mp[s[i]] = 1;elsemp[s[i]]++;sum1++;}else if(!(i % 2)){if(!np[s[i]])np[s[i]] = 1;elsenp[s[i]]++;sum2++;}}map<char, int>::iterator i;for(i = mp.begin(); i != mp.end(); i++)if(i->second > maxx1)maxx1 = i->second;for(i = np.begin(); i != np.end(); i++)if(i->second > maxx2)maxx2 = i->second;printf("%d\n", sum1 - maxx1 + sum2 - maxx2);}return 0; }
转载于:https://www.cnblogs.com/RootVount/p/11586894.html
HDU 6264 Super-palindrome相关推荐
- hdu 5062 Beautiful Palindrome Number(水题)
题目链接:hdu 5062 Beautiful Palindrome Number 题目大意:略. 解题思路:暴力或者手算都可以,注意手算的话,分别算出1,2,3...位的情况后,答案是累加上去的. ...
- HDU OJ Super Jumping! Jumping! Jumping!
Super Jumping! Jumping! Jumping! Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K ...
- hdu 1087 Super Jumping! Jumping! Jumping!
Nowadays, a kind of chess game called "Super Jumping! Jumping! Jumping!" is very popular i ...
- hdu 1087 Super Jumping! Jumping! Jumping! 动态规划
Super Jumping! Jumping! Jumping! Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K ...
- DP专题训练之HDU 1087 Super Jumping!
Description Nowadays, a kind of chess game called "Super Jumping! Jumping! Jumping!" is ve ...
- hdu 1087 Super Jumping! Jumping! Jumping!
Nowadays, a kind of chess game called "Super Jumping! Jumping! Jumping!" is very popular i ...
- HDU 1087 Super Jumping! Jumping! Jumping!【最大递增子段和】
Problem Description Nowadays, a kind of chess game called "Super Jumping! Jumping! Jumping!&quo ...
- 最长上升子序列模板 hdu 1087 Super Jumping! Jumping! Jumping!
Nowadays, a kind of chess game called "Super Jumping! Jumping! Jumping!" is very popular i ...
- HDU 6264 Super-palindrome(CCPC2017杭州) 水题
http://acm.hdu.edu.cn/showproblem.php?pid=6264 题目大意:给定字符串TTT,使得该字符串的每个长度为奇数的子串都是回文串,求至少要修改的字符的数量. 思路 ...
- hdu - 1087 - Super Jumping! Jumping! Jumping!
题意:求最大升序和. 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1087 -->>设d[i]表示以第i个数为终点的最大升序和,然后从第1 ...
最新文章
- 微服务之旅:从 Netflix OSS 到 Istio Service Mesh
- UVALive 4216 	 Pole Position
- 图像理解之物体检测object detection,模型rcnn/fastrcnn/fasterrcnn原理及概念
- linux服务器磁盘格式,linux下查看磁盘分区的文件系统格式
- mysql排序行号_mysql 取得行号后再排序
- 专访阿里数据库备份专家 教你pick最有效的备份系统
- Codeforces Round #409 (rated, Div. 2, based on VK Cup 2017 Round 2)C. Voltage Keepsake
- 五分钟快速入门 Spring Data JPA
- javascript使用事件委托
- 用nginx部署前端项目
- Unity3D开源棋牌游戏
- 用微信公众号做淘宝优惠券查券搜券和返利机器人的详细配置教程
- 变频器LED显示灯闪烁_图文并茂,彻头彻尾认识变频器,适合初学者!
- VisionPro实现测量工件内圆尺寸
- 英语语法——名词和名词性从句
- 计算机专业综合理论模拟测试卷五,2020银保监会考试题库:计算机类模拟试题练习(五)...
- 怎么恢复大疆无人机TF卡误删除格式化的MP4和MOV视频
- 自定义输入框可一键清除
- HTML+CSS+JS制作一个生日祝福网站(程序员专属情人节表白网站)
- iOS9 3DTouch开发 知识点详解
热门文章
- luogu P2791 幼儿园篮球题
- [CodeForces1070C]Cloud Computing(2018-2019 ICPC, NEERC, Southern Subregional Contest )
- MySQL之架构与历史(二)
- python sys模块
- how tomcat works
- PHP学习笔记六【方法-递归】
- 移动客户端与服务器端安全通信方案
- 解决git bash闪退问题
- Python sys.stdout sys.stdin
- 【虾说区块链】入门区块链,先学分布式系统!一文说明分布式系统与区块链的关系...