当前位置:网站首页>Openjudge noi 1.7 08: character substitution
Openjudge noi 1.7 08: character substitution
2022-07-07 01:02:00 【Jun Yi_ noip】
【 Topic link 】
OpenJudge NOI 1.7 08: Character substitution
【 Topic test site 】
1. character string
【 Solution code 】
solution 1: Use character array
#include <bits/stdc++.h>
using namespace std;
int main()
{
char s[35], a, b;// character a Replace with b
cin >> s >> a >> b;
int len = strlen(s);
for(int i = 0; i < len; i++)
{
if(s[i] == a)
s[i] = b;
}
cout << s;
return 0;
}
solution 2: Use string class
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
char a, b;// character a Replace with b
cin >> s >> a >> b;
for(int i = 0; i < s.length(); i++)
{
if(s[i] == a)
s[i] = b;
}
cout << s;
return 0;
}
边栏推荐
- 深度学习简史(二)
- Telerik UI 2022 R2 SP1 Retail-Not Crack
- 在jupyter中实现实时协同是一种什么体验
- 【JokerのZYNQ7020】AXI_ EMC。
- Advanced learning of MySQL -- basics -- multi table query -- self join
- Distributed cache
- 5种不同的代码相似性检测,以及代码相似性检测的发展趋势
- 深度学习之线性代数
- How to get started and improve test development?
- Periodic flash screen failure of Dell notebook
猜你喜欢

学习光线跟踪一样的自3D表征Ego3RT

Lombok makes ⽤ @data and @builder's pit at the same time. Are you hit?

Five different code similarity detection and the development trend of code similarity detection

New feature of Oracle 19C: automatic DML redirection of ADG, enhanced read-write separation -- ADG_ REDIRECT_ DML

Installation and testing of pyflink

【批處理DOS-CMD命令-匯總和小結】-字符串搜索、查找、篩選命令(find、findstr),Find和findstr的區別和辨析

Dell筆記本周期性閃屏故障

windows安装mysql8(5分钟)

Part 7: STM32 serial communication programming
![[batch dos-cmd command - summary and summary] - string search, search, and filter commands (find, findstr), and the difference and discrimination between find and findstr](/img/4a/0dcc28f76ce99982f930c21d0d76c3.png)
[batch dos-cmd command - summary and summary] - string search, search, and filter commands (find, findstr), and the difference and discrimination between find and findstr
随机推荐
Explain in detail the matrix normalization function normalize() of OpenCV [norm or value range of the scoped matrix (normalization)], and attach norm_ Example code in the case of minmax
新手如何入门学习PostgreSQL?
What is time
Deep understanding of distributed cache design
Data sharing of the 835 postgraduate entrance examination of software engineering in Hainan University in 23
New feature of Oracle 19C: automatic DML redirection of ADG, enhanced read-write separation -- ADG_ REDIRECT_ DML
mongodb客户端操作(MongoRepository)
第六篇,STM32脉冲宽度调制(PWM)编程
Advanced learning of MySQL -- Fundamentals -- four characteristics of transactions
详解OpenCV的矩阵规范化函数normalize()【范围化矩阵的范数或值范围(归一化处理)】,并附NORM_MINMAX情况下的示例代码
alexnet实验偶遇:loss nan, train acc 0.100, test acc 0.100情况
建立自己的网站(17)
Part VI, STM32 pulse width modulation (PWM) programming
Advantages and disadvantages of code cloning
fastDFS数据迁移操作记录
《安富莱嵌入式周报》第272期:2022.06.27--2022.07.03
Configuring the stub area of OSPF for Huawei devices
windows安装mysql8(5分钟)
Trace tool for MySQL further implementation plan
Dell笔记本周期性闪屏故障