当前位置:网站首页>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;
}边栏推荐
- 我最高产的EasyPyPI又双叒叕更新了!v1.4.0发布
- MySQL replication table
- 2022-07-16:以下go语言代码输出什么?A:[];B:[5];C:[5 0 0 0 0];D:[0 0 0 0 0]。 package main import ( “fmt“ )
- ES6 learning notes - brother Ma at station B
- Redis和其他数据库的比较
- Basic IDL content of note 1: common data types_ Create array_ Type conversion_ Print output_ Basic operation_ Relational operation
- Go语言中的Iota关键字怎么使用
- Specifications, multi table query basis
- Bisenetv2 face segmentation ncnn reasoning
- oracle 查询非自增长分区的最大分区
猜你喜欢
![深入理解机器学习——类别不平衡学习(Imbalanced Learning):样本采样技术-[人工采样技术之SMOTE采样法及Borderline-SMOTE采样法]](/img/9f/a0d03b23e66849f12150f9a72f36c5.png)
深入理解机器学习——类别不平衡学习(Imbalanced Learning):样本采样技术-[人工采样技术之SMOTE采样法及Borderline-SMOTE采样法]

Pytorch best practices and code templates
![[NoSQL] redis configuration and optimization of NoSQL (simple operation)](/img/e4/dcfeb675fd0ff4be3687547b28048d.png)
[NoSQL] redis configuration and optimization of NoSQL (simple operation)
![Theoretical basis and code implementation of dueling dqn [pytoch + pendulum-v0]](/img/f6/cbfe32991449975fe51f2e2c0c1d47.png)
Theoretical basis and code implementation of dueling dqn [pytoch + pendulum-v0]

JDBC connection to MySQL database

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

MySQL面试题(2022)
![2022-07-16:以下go语言代码输出什么?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:以下go语言代码输出什么?A:[];B:[5];C:[5 0 0 0 0];D:[0 0 0 0 0]。 package main import ( “fmt“ )

Can't access this website can't find DNS address DNS_ PROBE_ What about started?

数据源对象管理(第三方对象资源) & 加载properties文件
随机推荐
Cmake common commands
[MCU simulation] (XIII) instruction system logic operation instruction shift instruction
代理模式——B站动力节点
374. 猜数字大小(入门 必会)
Face key point detection
Yolov5 opencv DNN reasoning
RuntimeError_ Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor)
[MCU simulation] (XV) instruction system bit operation instructions - bit operation instructions, bit conditional transfer instructions
Leetcode: multiple knapsack problem in dynamic programming [one template solves all ~]
【剑指Offer】31-35题(判断一个序列是否是栈的出栈序列之一,层序打印二叉树以及分行打印、每行逆着打印),判断序列是否是二叉搜索树的后序遍历路径,二叉树找一条权值为K的路径,复制复杂链表
Ubuntu clear CUDA cache
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“ )
First knowledge of JPA (ORM idea, basic operation of JPA)
Powertor500t reports an error 0x01806803
[NoSQL] redis high availability and persistence
Zabbix6.0 monitoring vcenter7.0
[MCU simulation] (XVII) control transfer instructions - call and return instructions
Theoretical basis of double Q-learning and its code implementation [pendulum-v0]
Bisenetv1 face segmentation
Yolov5 ncnn reasoning
