当前位置:网站首页>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;
}
边栏推荐
- Shell script receives and returns parameters
- 洛谷每日三题之第四天
- Note: light source selection and Application
- Polynomial interpolation fitting (I)
- [MCU simulation] (XV) instruction system bit operation instructions - bit operation instructions, bit conditional transfer instructions
- Wechat applet
- Bisenetv2 face segmentation
- A Youku VIP member account can be used by several people to log in at the same time. How to share multiple people using Youku member accounts?
- Snapshot: data snapshot (data disclosure method)
- In depth understanding of machine learning - unbalanced learning: sample sampling technology - [adasyn sampling method of manual sampling technology]
猜你喜欢

Latest installation tutorial of VMware Tools (rhel8)

数据源对象管理(第三方对象资源) & 加载properties文件

Leetcode: subsequence problem in dynamic programming
![[template record] string hash to judge palindrome string](/img/90/43109c6bd008990fa5b8147e629685.png)
[template record] string hash to judge palindrome string

Redis和其他数据库的比较

Wechat applet -- Summary of problems in the actual development of taro framework

Powertor500t reports an error 0x01806803

GraphQL初识

Chengxin University envi_ IDL first week experiment test: simple operation of array + detailed analysis

通过OpenHarmony兼容性测评,大师兄开发板与丰富教培资源已ready
随机推荐
04_ Service registration Eureka
CorelDRAW 安装不了解决方法
XX市高中网络拓扑整体规划配置
[single chip microcomputer simulation] (XII) instruction system logic operation instruction - logic XOR instruction XRL, accumulator clear 0 and reverse instruction
Transaction and storage engine in MySQL database
Graphql first acquaintance
ES6学习笔记——B站小马哥
Is there really no way out for functional testing? 10K capping is never a joke
Rhce8 Study Guide Chapter 2 use of basic commands
[template record] string hash to judge palindrome string
RTX3090安装pytorch3D
It's good to take more exercise
深入理解机器学习——类别不平衡学习(Imbalanced Learning):样本采样技术-[人工采样技术之SMOTE采样法及Borderline-SMOTE采样法]
MySQL interview questions (2022)
oracle 查询 主机名和对应的IP地址
367. 有效的完全平方数(入门必会)
[MCU simulation] (XVIII) control transfer instructions - empty operation instructions
Win10 network connection shows no network but Internet access
Leetcode: subsequence problem in dynamic programming
IEEE754 standard floating point format