关于一些初级ACM竞赛题目的分析和题解(三)。

今天,辣鸡monster_ayb终于自己做出一道A题算是一点点小进步吧,今天的两道题算是很好理解的,主要是辣鸡ayb以前吧,是知道题目的思路,却不会写,现在练的多了有一点点小的进步,废话少说,直接上题:

266A    A. Stones on the Table

There are n stones onthe table in a row, each of them can be red, green or blue. Count the minimumnumber of stones to take from the table so that any two neighboring stones haddifferent colors. Stones in a row are considered neighboring if there are noother stones between them.

Input

The first linecontains integer n (1 ≤ n ≤ 50) — thenumber of stones on the table.

The next linecontains string s, which represents the colors of thestones. We'll consider the stones in the row numbered from 1 to n from leftto right. Then the i-th character s equals"R", ifthe i-th stone isred, "G", if it'sgreen and "B", if it'sblue.

Output

Print a singleinteger — the answer to the problem.

Examples

input

3
RRG

output

1

input

5
RRRRR

output

4

input

4
BRBG

output

0

这道题很好理解 要求连续的字母不同,字母个数【0,50】, 输入一行字母,问删去多少个字母才能达到要求,上代码:

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,i,m;
char s[100];   //  定义字符串
main()
{cin>>n>>s;     //   输入n和字符串
for (i=0;i<n-1;i++)
{ if (s[i]==s[i+1]) m++; }  //    判断相等条件  并计数
cout<<m;  //   输出计数值
}
A. Word Capitalization
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

Capitalization is writing a word with its first letter as a capital letter. Your task is to capitalize the given word.

Note, that during capitalization all the letters except the first one remains unchanged.

Input

A single line contains a non-empty word. This word consists of lowercase and uppercase English letters. The length of the word will not exceed 103.

Output

Output the given word after capitalization.

Examples
input
ApPLe

output
ApPLe

input
konjac

output
Konjac

题目很简单 首字母大写的 直接输出, 首字母小写的,把首字母变为大写再全部输出,字母数小于1000,下面是代码:

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{int a,b,c;char s[1100];   //定义字符串scanf("%s",s);   //   输入字符串if (s[0]>=97) s[0]-=32;   //   判断条件 并作出执行printf("%s",s);   //   输出字符串
}

好了,今天做的题也涉及到了ASCII码的一些内容,众所周知若是用 %d 来输出一个字母时 输出的是该字母在ASCII上对应的数字   但作为一个竞赛人 也应该记住一些常用的    如 65-A    到  90-Z

97-a 到 122-z    48-0  到  57-9 但也要注意一些细节 如

int  a;
a='0';
printf("%d",a);   //  这样的话输出的结果是  48


int  a;
a=0;
printf("%d",a);   //   这样的话就输出的只是 0 这个值了


关于一些初级ACM竞赛题目的分析和题解(三)。相关推荐

  1. 关于一些初级ACM竞赛题目的分析和题解(二)。

    关于一些初级ACM竞赛题目的分析和题解(二). 今天写了关于排序的题  中间有加号的复杂的一行字符   其次还有关于tolower函数的应用, 上题                           ...

  2. 关于一些初级ACM竞赛题目的分析和题解(十)

    关于一些初级ACM竞赛题目的分析和题解(十) 西面的题目是关于一些字母变换的,上题: A. Word time limit per test 2 seconds memory limit per te ...

  3. 关于一些初级ACM竞赛题目的分析和题解(六)。

    关于一些初级ACM竞赛题目的分析和题解(六). 下面是关于一些关于数字判断的题,比较简单,先来看第一题: A. Lucky Division time limit per test 2 seconds ...

  4. SAS初级编程系列视频:第三章编辑和调试SAS程序

    SAS初级编程系列视频:第三章编辑和调试SAS程序 SAS初级编程系列视频:第三章编辑和调试SAS程序

  5. 2019浙江ACM省赛部分题解-ABDEFGHIJK

    太菜了,心态炸了.QAQ A-Vertices in the Pocket() 题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?proble ...

  6. 华东交通大学2018年ACM双基程序设计大赛题解

    华东交通大学2018年ACM"双基"程序设计竞赛 代码头多的都是标答Ctrl+c下来的,给自己挖个坟,回头有时间再填回去,不填回去就死在这里吧-- 传送门:https://ac.n ...

  7. CDOJ 第七届ACM趣味程序设计竞赛第三场(正式赛) 题解

    宝贵资源 题目连接: http://acm.uestc.edu.cn/#/problem/show/1265 题意 平面上给n个点(n<=1000),要求找一个面积最小的正方形,将所有的点都囊括 ...

  8. ACM新生赛部分题解

    2021级的ACM新生赛已经完结了,我就自己做出来的八道题整理一下题解,因为其他是真的不会. 链接:登录-专业IT笔试面试备考平台_牛客网 来源:牛客网 一.我们是冠军 7 日星期 777 的凌晨,7 ...

  9. 2021暨南大学轩辕杯ACM程序设计新生赛题解

    title : 2021暨南大学轩辕杯ACM程序设计新生赛 date : 2021-12-12 tags : ACM,练习记录 author : Linno 题目链接:https://ac.nowco ...

  10. 2018年第十届ACM四川省省赛题解(10 / 11)

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 2018ACM四川省省赛 题目链接:https://www.oj.swust.edu.cn/probl ...

最新文章

  1. 基于K8S构建企业级Jenkins CI/CD平台实战(三) 之 带你实战Spring boot/Cloud 项目 CI/CD jenkins自动化构建、部署过程
  2. 如何去掉Silverlight应用程序在浏览器中的滚动条
  3. Go 语言编程 — 使用 delve 进行 DEBUG 调试
  4. 【工具使用系列】关于 MATLAB 液压机构,你需要知道的事
  5. CUDA程序编写具体参数设置
  6. zookeeper安装包下载地址
  7. C语言中__attribute__ ((at())绝对定位的应用
  8. c#编程指南(四) 组元(Tuple)
  9. TCP-IP协议栈概略图与TCP三次握手四次挥手
  10. 南阳理工acm,水仙花数
  11. 英文论文写作LaTeX模板
  12. 华硕老毛子(Padavan)——校园网锐捷(Ruijie)认证路由器开机启动设置(开机脚本设置)
  13. PReLU, LReLU, ReLU
  14. UU加速器——学术资源加速
  15. 【科普贴】MDIO接口详解
  16. c语言中int sel是什么意思,SEL数据类型,@selector的用法,以及调用SEL
  17. 我们期待自己成为一个优秀的软件模型设计者
  18. 【硬件篇之电源纹波噪声测试】
  19. liu四声拼音怎么读_刘的拼音怎么读
  20. 横版过关游戏开发-碰撞检测

热门文章

  1. java wsdl 生成_请问java文件wsdl文件如何生成
  2. python 实现 pdf 书签读取、批量写入
  3. H2GIS读取GPX文件 测试 GPXRead
  4. Navicat12注册机下载Navicat Premium12.1.17
  5. 微信小程序·实现列表页和详情页同步收藏
  6. docker搭建pgadmin并挂载
  7. 《计算机网络 自顶向下方法》答案(第七章)
  8. jQuery weui 时间选择器datetimepicker只用年月日
  9. Dbgview退出再打开无法使用的解决办法
  10. mac上安装和启动kafka