当前位置:网站首页>The third day of the three questions of Luogu daily (make up on the fourth day)
The third day of the three questions of Luogu daily (make up on the fourth day)
2022-07-19 03:28:00 【Xiao Tang (๑ & gt; & lt; ๑)】
The plan was disrupted yesterday for some reasons , Make up today .
Catalog
P5015 [NOIP2018 Popularization group ] Headline Statistics
P5015 [NOIP2018 Popularization group ] Headline Statistics
Title Description
Kaikai has just written a wonderful composition , How many characters are there in the title of this composition ? Be careful : The title may contain large 、 Small letters 、 Numeric character 、 Spaces and line breaks . Statistics title words Symbol time , Spaces and line breaks are not counted .
Input format
The input file has only one line , A string ss.
Output format
The output file has only one line , Contains an integer , The number of characters in the title of the composition ( No spaces and line breaks ).
I/o sample
Input #1 Copy
234Output #1 Copy
3Input #2 Copy
Ca 45Output #2 Copy
4explain / Tips
【 I/o sample 1 explain 】
The title has 3 Characters , this 3 All characters are numeric characters .【 I/o sample 2 explain 】 The title has 55 Characters , Include 11 Capital letters , 11 Small letters and 22 Number characters , also 11 A space . Because spaces are not included in the result , Therefore, the effective number of characters in the title is 44 individual .
【 Data scale and agreement 】
Regulations |s|∣s∣ Representation string ss The length of ( That is, the number of characters and spaces in the string ).
about 40\%40% The data of ,1 ≤ |s| ≤ 51≤∣s∣≤5, Ensure that the input is numeric characters and line breaks at the end of the line .
about 80\%80% The data of ,1 ≤ |s| ≤ 51≤∣s∣≤5, The input can only contain large 、 Small letters 、 Numeric characters and line breaks at the end of a line .
about 100\%100% The data of ,1 ≤ |s| ≤ 51≤∣s∣≤5, Input may contain large 、 Small letters 、 Numeric character 、 Spaces and line breaks at the end of a line .
# include <bits/stdc++.h>
using namespace std;
int main()
{
string n;
getline(cin,n);
int l=n.length();
int u=0;
for(int i=0;i<l;i++)
{
if(n[i]>='0'&&n[i]<='9')
{
u++;
// cout<<" Numbers "<<endl;
}
if(n[i]>='a'&&n[i]<='z')
{
u++;
//cout<<" Lowercase letters "<<endl;
}
if(n[i]>='A'&&n[i]<='Z')
{
//cout<<" Capital "<<endl;
u++;
}
}
cout<<u;
}P5734 【 Deep base 6. example 6】 Word processing software
Title Description
You need to develop a word processing software . At the beginning, enter a string as the initial document . It can be considered that the beginning of the document is 00 Characters . The following operations need to be supported :
1 str: Followed by insertion , Insert a string after the document \texttt{str}str, And output the string of the document .
2 a b: Intercept the document part , Only keep documents from aa Start with two characters bb Characters , And output the string of the document .
3 a str: Insert clip , In the document, section aa Insert a string before characters \texttt{str}str, And output the string of the document .
4 str: Find substring , Find string \texttt{str}str In the first place in the document and output ; If the output cannot be found -1−1.To simplify the problem , Specify the initial document and the... In each operation \texttt{str}str There are no spaces or line breaks . There will be at most qq operations .
Input format
Enter a positive integer in the first line qq, Indicates the number of operations .
Enter a string in the second line \texttt{str}str, Represents the first string .
The third line begins , Down qq That's ok , Each line represents an operation , The operation is shown in the Title Description .
Output format
Total output nn That's ok .
For each operation 1,2,31,2,3, Output a string according to the requirements of the operation .
For operation 44, Output an integer according to the requirements of the operation .
I/o sample
Input #1 Copy
4 ILove 1 Luogu 2 5 5 3 3 guGugu 4 guOutput #1 Copy
ILoveLuogu Luogu LuoguGugugu 3explain / Tips
Data assurance ,1 \leq q\le 1001≤q≤100, Start string length \leq 100≤100.
# include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
string s0;
cin>>s0;
int m;
string s1;
for(int i=0;i<n;i++)
{
cin>>m;
switch(m)
{
case 1 :
cin>>s1;
s0.append(s1);
cout<<s0<<endl;
break;
case 2 :
int a,b;
cin>>a>>b;
s0=s0.substr(a,b);
cout<<s0<<endl;
break;
case 3 :
cin>>a;
cin>>s1;
s0.insert(a,s1);
cout<<s0<<endl;
break;
case 4 :
cin>>s1;
int y=s0.find(s1);
cout<<y<<endl;
break;
}
}
} P1765 mobile phone
Title Description
The keyboard of a mobile phone is like this :
You have to press the number key many times to press the English letters . For example, to press
xJust press 9 both parties , The first one will come outw, And the second one willwbecomex.0 Press the key once and a space will appear .Your task is to read several sentences that contain only lowercase letters and spaces , Find out at least how many keystrokes you need to press to type this sentence on your mobile phone .
Input format
A line of sentences , Contains only lowercase letters and spaces , And no more than 200 Characters .
Output format
One line, one integer , Indicates the total number of keystrokes .
I/o sample
Input #1 Copy
i have a dreamOutput #1 Copy
23explain / Tips
NOI Guide 2010 Universal (10)
# include <bits/stdc++.h>
using namespace std;
int main()
{
int count=0;
string a;
getline(cin,a);
int l=a.length();
for(int i=0;i<l;i++)
{
if(a[i]=='a'||a[i]=='d'||a[i]=='g'||a[i]=='j'||a[i]=='m'||a[i]=='p'||a[i]=='t'||a[i]=='w'||a[i]==' ')
{
count++;
}
if(a[i]=='b'||a[i]=='e'||a[i]=='h'||a[i]=='k'||a[i]=='n'||a[i]=='q'||a[i]=='u'||a[i]=='x')
{
count=count+2;
}
if(a[i]=='c'||a[i]=='f'||a[i]=='i'||a[i]=='l'||a[i]=='o'||a[i]=='r'||a[i]=='v'||a[i]=='y')
{
count=count+3;
}
if(a[i]=='s'||a[i]=='z')
{
count=count+4;
}
}
cout<<count;
}边栏推荐
- IEEE754 standard floating point format
- Monte Carlo based reinforcement learning method [with code implementation]
- Browser cannot open tensorboard
- Dive Into Deep Learning——2.2数据预处理
- Polynomial interpolation fitting (II)
- KubeCon + CloudNativeCon Europe 2022
- leetcode:78. 子集
- leetcode162. 寻找峰值
- Code demonstration of fcos face detection model in openvino
- Data source object management (third-party object resources) & load properties file
猜你喜欢

JDBC connection to MySQL database

Latest installation tutorial of VMware Tools (rhel8)

Wechat applet -- Summary of problems in the actual development of taro framework
![2022-07-16: what is the output of the following go language code? A:[]; B:[5]; C:[5 0 0 0 0]; D:[0 0 0 0 0]。 package main import ( “fmt“ )](/img/e4/ff7f1e19583f42377307de7291f870.png)
2022-07-16: what is the output of the following go language code? A:[]; B:[5]; C:[5 0 0 0 0]; D:[0 0 0 0 0]。 package main import ( “fmt“ )

ES6学习笔记——B站小马哥

05 central processing unit

Code demonstration of fcos face detection model in openvino

Rtx3090 installing pytorch3d

Shell script receives and returns parameters

Affine transformation implementation
随机推荐
Comparison between redis and other databases
Labelme starts normally, but cannot be opened
Thinking for half a year
[MCU simulation] (XIV) instruction system bit operation instructions - bit data transmission instructions MOV, bit variable modification instructions
Face key point detection
oracle 查询 主机名和对应的IP地址
[MySQL] data query operation (select statement)
leetcode:78. 子集
Chengxin University envi_ IDL second week homework: extract aerosol thickness at n points + detailed analysis
IEEE754 standard floating point format
Go语言中的Iota关键字怎么使用
05_ Service call ribbon
Rhce8 Learning Guide Chapter 1 installing rhel8.4
无线用的鉴权代码
Configure high availability using virtual ip+kept
Authentication code for wireless
Unity解决同材质物体重叠产生Z-Fighting的问题
[MCU simulation] (IX) instruction system - add, ADDC, sub, Inc, Dec, Da of arithmetic operation instructions
论文阅读:U-Net++: Redesigning Skip Connections to Exploit Multiscale Features in Image Segmentation
Browser cannot open tensorboard
