CodeForces 266 A.Stones on the Table(水~)
来源:互联网 发布:酒店淡季网络促销活动 编辑:程序博客网 时间:2024/06/05 08:12
Description
一排
Input
第一行一整数
Output
输出至少要拿走的石头数量
Sample Input
3
RRG
Sample Output
1
Solution
水题,相邻两个重复就拿走一个
Code
#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>#include<cmath>#include<vector>#include<queue>#include<map>#include<set>#include<ctime>using namespace std;typedef long long ll;typedef pair<int,int>P;const int INF=0x3f3f3f3f,maxn=100001;char s[maxn];int main(){ int n; while(~scanf("%d",&n)) { scanf("%s",s); int num=0; for(int i=1;i<n;i++)if(s[i]==s[i-1])num++; printf("%d\n",num); } return 0;}
阅读全文
0 0
- CodeForces 266 A.Stones on the Table(水~)
- CodeForces 266A Stones on the Table
- CodeForces-266A-Stones on the Table
- CodeForces 266A Stones on the Table
- codeforces 266A Stones on the Table
- codeforces 266A(Stones on the Table) Java
- codeforces 266A Stones on the Table(模拟水题)
- Problem--266A--Codeforces--Stones on the Table
- 小白题解 Codeforces 266A Stones on the Table
- CF - 266A - Stones on the Table
- 266A - Stones on the Table
- 266A - Stones on the Table
- CF 266A Stones on the Table
- A - Stones on the Table (hdu)
- A. Stones on the Table
- Codeforces刷题之路——266A Stones on the Table
- Stones on the Table
- Stones on the Table
- 依赖注入(DI)和控制反转(IOC)
- 数据迁移实施方案
- 隐匿输入
- matlab2c使用c++实现matlab函数系列教程-polyder函数
- 题目1172:哈夫曼树
- CodeForces 266 A.Stones on the Table(水~)
- WAMP环境配置
- 自定义View实现圆形百分比加载的效果
- Spring Boot学习--热部署
- 根据图片的ip找到图片
- 数位DP
- 动画
- WOJ1124-Football Coach
- 3d3d