当前位置:网站首页>20200217训练赛 L1 - 7 2019来了 (20分)
20200217训练赛 L1 - 7 2019来了 (20分)
2022-07-28 10:15:00 【小柳学渣】
判断数字序列S是否是由若干个2019拼接起来的。
输入格式:
每行给出一个长度为n的数字序列(由数字0~9组成,中间无其他字符,长度n<80)。
输出格式:
对一行数字序列,给出判断结果“Yes”或“No”。每个输出结果占一行。
输入样例:
20192019
201920
输出样例:
Yes
No
#include <bits/stdc++.h>
using namespace std;
int main()
{
string s;
while(getline(cin,s))
{
while(s.substr(0,4)=="2019")//substr(a,b),从a开始,截取长度为b的字符串
{
s.erase(0,4);//从a开始,删除长度为b
}
if(s.length()==0)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}
return 0;
}
边栏推荐
- 【栈的应用】--- 中缀表达式转后缀表达式
- a different object with the same identifier value was already associated with the session
- 12、双指针——合并两个有序链表
- Ie compatibility problem handling
- Multithreading and high concurrency (III) -- source code analysis AQS principle
- 4.调整数组顺序使奇数位于偶数前面
- Xu Ziyang, President of ZTE: 5nm chip will be launched in 2021
- Context values traps and how to avoid or mitigate these traps in go
- Aqua Data Studio 18.5.0导出insert语句
- a different object with the same identifier value was already associated with the session
猜你喜欢
随机推荐
12、双指针——合并两个有序链表
It is said that the global semiconductor equipment giant may build a joint venture factory in Shanghai!
ogg参数filter的使用问题【急】
Lucene 查询语法备忘
6. Double pointer -- the sum of the two numbers of the incremental array is equal to the target number
SQL Server 2016 learning records - data update
多线程与高并发(三)—— 源码解析 AQS 原理
KingbaseES V8R6 JDBC 能否使用VIP ?
8. Numbers that appear more than half of the time in the array
简介
Aqua Data Studio 18.5.0 export insert statement
用K-means聚类分类不同行业的关税模型
IDEA打包jar包及运行jar包命令
用两个栈实现一个队列【C语言】
SQL Server 2016 学习记录 --- 数据定义
指令系统超全知识点详解
Database mysql Foundation
【微信小程序】项目实战—抽签应用
Record a parent-child project in idea, modify the name of project and module, and test it personally!
Double pointer technique









