题意:现在给定一个由R、G、B三个字母组成的字符串,每次操作可将任意一个位置的字符换成任意一个{ R, G, B }中的字符,问最少进行多少次操作,能使得此字符串任意位置的字符不与其左右位置的字符相同。同时输出改后的字符串。
题解:首先如果相邻的相同我肯定要改一个,那我肯定能改哪个就改哪个只要改后不矛盾就行,这其实是一个动态的过程,一遍修改一边判断。
题意:现在给定一个由R、G、B三个字母组成的字符串,每次操作可将任意一个位置的字符换成任意一个{ R, G, B }中的字符,问最少进行多少次操作,能使得此字符串任意位置的字符不与其左右位置的字符相同。同时输出改后的字符串。
题解:首先如果相邻的相同我肯定要改一个,那我肯定能改哪个就改哪个只要改后不矛盾就行,这其实是一个动态的过程,一遍修改一边判断。
【Linux】指令与图形化界面详细介绍命令行与图形化界面的相关内容……
gorithm>#in...
http://codeforces.com/problemset/problem/76
题目链
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M