当前位置:网站首页>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;
}边栏推荐
- Chengxin University envi_ The second week of IDL experiment content: extract aod+ in all MODIS aerosol products for detailed analysis
- Unicast、Multicast、Broadcast
- The installation software prompts that the program input point adddlldirectory cannot be located in the dynamic link library kernel32 DLL (download address at the end of the text)
- Note: light source selection and Application
- Code demonstration of fcos face detection model in openvino
- [template record] string hash to judge palindrome string
- CorelDRAW 安装不了解决方法
- This is a mathematical problem
- Snapshot: data snapshot (data disclosure method)
- MySQL optimized index
猜你喜欢

通过Dao投票STI的销毁,SeekTiger真正做到由社区驱动

Yolov6 learning first chapter

374. 猜数字大小(入门 必会)

Visual analysis of ncnn param file and bin model

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

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

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

Leetcode: subsequence problem in dynamic programming

First knowledge of JPA (ORM idea, basic operation of JPA)
![Theoretical basis of doubledqn and its code implementation [pytoch + pendulum-v0]](/img/f2/4a3cc8e5173789111080915aceb9fd.png)
Theoretical basis of doubledqn and its code implementation [pytoch + pendulum-v0]
随机推荐
Leetcode: multiple knapsack problem in dynamic programming [one template solves all ~]
Basic IDL content of note 1: common data types_ Create array_ Type conversion_ Print output_ Basic operation_ Relational operation
ES6 learning notes - brother Ma at station B
Graphql first acquaintance
leetcode:78. 子集
[MCU simulation] (XX) org - set start address
05_ Service call ribbon
[MCU simulation] (XVIII) control transfer instructions - empty operation instructions
[MCU simulation] (XXI) dB (define byte) - define byte
module_ Basic principle of init function
Comparison between redis and other databases
2002 - Can‘t connect to server on ‘127.0.0.1‘ (36)
mysqldump: [Warning] Using a password on the command line interface can be insecure.
Display zabbix6.0 information using grafana8.5.2
[single chip microcomputer simulation] (XI) instruction system logic operation instruction - logic and instruction anl, logic or instruction ORL
Ubuntu clear CUDA cache
[template record] string hash to judge palindrome string
Unicast、Multicast、Broadcast
Yolov5 ncnn reasoning
Visual analysis of ncnn param file and bin model
