当前位置:网站首页>The fourth day of the third question of daily Luogu
The fourth day of the third question of daily Luogu
2022-07-19 03:28:00 【Xiao Tang (๑ & gt; & lt; ๑)】
P3741 honoka Keyboard for
Background
honoka There is a keyboard with only two keys .
Title Description
One day , She typed a string with only these two characters . When this string contains
VKWhen this string ,honoka I especially like this string . therefore , She wants to change at most one character ( Or don't make any changes ) To maximize the number of characters in this stringVKNumber of occurrences . Give the original string , Please calculate the maximum number of times she can make this string appearVK( Only whenVandKJust adjacent , We think there isVK.)Input format
The first line gives a number nn, Represents the length of the string .
The second line gives a string ss.
Output format
The first line outputs an integer representing the answer .
I/o sample
Input #1 Copy
2 VKOutput #1 Copy
1Input #2 Copy
2 VVOutput #2 Copy
1Input #3 Copy
1 VOutput #3 Copy
0Input #4 Copy
20 VKKKKKKKKKVVVVVVVVVKOutput #4 Copy
3Input #5 Copy
4 KVKVOutput #5 Copy
1explain / Tips
about 100\%100% The data of ,1\le n\le 1001≤n≤100.
# include <cstring>
#include<cstdio>
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
string s;
cin>>s;
int count=0;
int l=s.length();
int blp=-1;
//s[blp]='x';
//s[blp+1]='x';
while(s.find("VK",blp+1)!=-1)
{
count++;
blp=s.find("VK",blp+1);
s[blp]='T';
s[blp+1]='T';
}
// cout<<count<<endl;
// cout<<s;
for(int i=0;i<l-1;i++)
{
string w="KK";
string e="VV";
if(s.find(w)!=-1)
{
count++;
break;
}
if(s.find(e)!=-1)
{
count++;
break;
}
// if((s[i-1]=='V'&&s[i]=='V')||(s[i+1]=='K'&&s[i]=='K'))
// {
// count++;
// break;
// }
}
cout<<count;
}P1000 Super Mary game
This question is to make up the number ( Time reason )
Background
This is the test question of Luogu , It can help understand the use of Luogu .
It is suggested to continue to try after completing this topic P1001、P1008.
Also highly recommended New user must read post
Title Description
Super Mary is a very classic game . Please output a scene in super Mary in the form of character drawing .
******** ************ ####....#. #..###.....##.... ###.......###### ### ### ........... #...# #...# ##*####### #.#.# #.#.# ####*******###### #.#.# #.#.# ...#***.****.*###.... #...# #...# ....**********##..... ### ### ....**** *****.... #### #### ###### ###### ############################################################## #...#......#.##...#......#.##...#......#.##------------------# ###########################################------------------# #..#....#....##..#....#....##..#....#....##################### ########################################## #----------# #.....#......##.....#......##.....#......# #----------# ########################################## #----------# #.#..#....#..##.#..#....#..##.#..#....#..# #----------# ########################################## ############Input format
nothing
Output format
As described
I/o sample
nothing
# include <stdio.h>
int main()
{
printf(
" ********\n"
" ************\n"
" ####....#.\n"
" #..###.....##....\n"
" ###.......###### ### ###\n"
" ........... #...# #...#\n"
" ##*####### #.#.# #.#.#\n"
" ####*******###### #.#.# #.#.#\n"
" ...#***.****.*###.... #...# #...#\n"
" ....**********##..... ### ###\n"
" ....**** *****....\n"
" #### ####\n"
" ###### ######\n"
"##############################################################\n"
"#...#......#.##...#......#.##...#......#.##------------------#\n"
"###########################################------------------#\n"
"#..#....#....##..#....#....##..#....#....#####################\n"
"########################################## #----------#\n"
"#.....#......##.....#......##.....#......# #----------#\n"
"########################################## #----------#\n"
"#.#..#....#..##.#..#....#..##.#..#....#..# #----------#\n"
"########################################## ############\n"
);
return 0;}
P1001 A+B Problem
This problem was also written a long time ago
Background
Strongly recommend New users must read the post .
For those who are not familiar with algorithm competition, please see here :
The output format required in the algorithm competition , There should be no superfluous content , It also includes “ please enter an integer \bm aa and \bm bb” This kind of prompt users to enter information . If these contents are included , Will be regarded as
Wrong Answer, That is, on the valley of Los AngelesWA. When comparing code output with standard output , The system will ignore the spaces at the end of each line , And extra line breaks after the last line .If this machine appears due to such problems ( look )
AC, SubmitWAThe phenomenon of , Don't think that there is something wrong with the Luogu evaluation machine , Instead, there may be redundant output information in your code . Users can refer to the code provided at the end of the title .in addition Please make good use of the online application IDE function , To avoid some problems arising from the evaluation of different platforms .
It's also important , Please do not post your own solutions in the corresponding topic discussion area , Please post to the problem solving area , Otherwise, it will be punished by deletion or prohibition . If it is found that the solutions cannot be submitted, it indicates that there are too many solutions to this problem , Discussions should still not be posted .
Title Description
Enter two integers a, ba,b, Output their sum (|a|,|b| \le {10}^9∣a∣,∣b∣≤109).
Be careful
- Pascal Use
integerIt will explode !- There are negative numbers !
- C/C++ Of main The function must be
inttype , and C Finallyreturn 0. This is not only valid for other topics in Los Angeles , And it's also NOIP/CSP/NOI The requirements of the game !ok , Comrades , Let's start with this question , Heading for Daniel's road .
Any great idea , There's a tiny beginning .
Input format
Two integers separated by spaces .
Output format
An integer .
I/o sample
Input #1 Copy
20 30Output #1 Copy
50
# include <stdio.h>
int main()
{
long long a,b;
scanf("%lld",&a);
scanf("%lld",&b);
printf("%lld",a+b);
return 0;
}
边栏推荐
- Unicast、Multicast、Broadcast
- Leetcode: 0-1 knapsack problem in dynamic programming [come and set the template directly]
- Zabbix6.0 monitoring vcenter7.0
- 自动装配 & 集合注入
- Visual analysis of ncnn param file and bin model
- Yolov5 ncnn reasoning
- Net SNMP related commands
- 论文阅读:U-Net++: Redesigning Skip Connections to Exploit Multiscale Features in Image Segmentation
- Configure high availability using virtual ip+kept
- Polynomial interpolation fitting (I)
猜你喜欢

Automatic assembly & set injection
![[MySQL] MHA high availability](/img/d3/d9830f3c331193fd40b8f00ebe35fa.png)
[MySQL] MHA high availability

Display zabbix6.0 information using grafana8.5.2

leetcode 222. 完全二叉树的节点个数(必会)

Zabbix6.0 monitoring vcenter7.0
![[NoSQL] redis configuration and optimization of NoSQL (simple operation)](/img/e4/dcfeb675fd0ff4be3687547b28048d.png)
[NoSQL] redis configuration and optimization of NoSQL (simple operation)

代理模式——B站动力节点
![[NoSQL] redis high availability and persistence](/img/73/53580db08b33c06c595fb3dfd6abce.png)
[NoSQL] redis high availability and persistence

XX市高中网络拓扑整体规划配置
![[Jianzhi offer] 31-35 questions (judge whether a sequence is one of the out of stack sequences, sequence print binary tree, branch print, and reverse print each line), judge whether the sequence is th](/img/fd/f0c0e17f2942525a78fbd443514992.png)
[Jianzhi offer] 31-35 questions (judge whether a sequence is one of the out of stack sequences, sequence print binary tree, branch print, and reverse print each line), judge whether the sequence is th
随机推荐
数据源对象管理(第三方对象资源) & 加载properties文件
Win10 network connection shows no network but Internet access
mysqldump: [Warning] Using a password on the command line interface can be insecure.
Zabbix6.0 monitors Dell and IBM server hardware through Idrac and imm2
深入理解机器学习——类别不平衡学习(Imbalanced Learning):样本采样技术-[人工采样技术之SMOTE采样法及Borderline-SMOTE采样法]
Go语言中的Iota关键字怎么使用
Envi: (the most detailed tutorial in 2022) custom coordinate system
367. 有效的完全平方数(入门必会)
[MCU simulation] (XXI) dB (define byte) - define byte
Rhce8 Study Guide Chapter 2 use of basic commands
In depth understanding of machine learning - unbalanced learning: sample sampling technology - [adasyn sampling method of manual sampling technology]
支持工业级瘦设备4G接入,润和软件DAYU120通过OpenHarmony兼容性测评
RESNET learning notes
洛谷每日三题之第五天
XX市高中网络拓扑整体规划配置
Gdb+vscode for debugging 8 - use core to analyze dead cycles, deadlocks, and segment errors
[MCU simulation] (XVI) control transfer instructions - unconditional transfer instructions, conditional transfer instructions
Ncnn allocator memory allocator
ncnn DataReader&Extractor&blob
Monte Carlo based reinforcement learning method [with code implementation]