当前位置:网站首页>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;
}
边栏推荐
- 15. Judge whether the target value exists in the two-dimensional array
- IDEA创建我的第一个项目
- 印度计划禁用中国电信设备!真离得开华为、中兴?
- 指令系统超全知识点详解
- Match file names from file paths using regular expressions
- Performance test of API gateway APIs IX in Google cloud T2a and T2D
- 发力大核、独显!英众科技2020十代酷睿独显产品发布
- KingbaseES V8R6 JDBC 能否使用VIP ?
- [wechat applet] project practice - lottery application
- 13、哈希表——两个链表第一个公共节点
猜你喜欢

SQL Server 2016 learning records - data update

SQL Server 2016 学习记录 --- 数据定义

SQL Server 2016 learning record - Data Definition

SQL Server 2016 学习记录 --- 集合查询

15. Judge whether the target value exists in the two-dimensional array

逆元&组合数&快速幂

多线程与高并发(三)—— 源码解析 AQS 原理

Typora使用教程

It's settled! On July 30!

Typora tutorial
随机推荐
IDEA打包jar包及运行jar包命令
Small knowledge in Oracle
[cloud co creation] enterprise digital transformation, Huawei cloud consulting is with you
PHP generates QR code (learning)
多线程与高并发(三)—— 源码解析 AQS 原理
JVM principle
uni-app项目目录、文件作用介绍 及 开发规范
Leetcode -- minimum number of rotation array
PHP生成二维码(学习)
Sleeping barber problem
What kind of knowledge payment system functions are more conducive to the development of the platform and lecturers?
SQL Server 2016学习记录 --- 连接查询
数据库mysql基础
4.调整数组顺序使奇数位于偶数前面
Read write separation standby backup error
Why does the cluster need root permission
How to write Ogg with multiple filter syntax?
Summary of key points of bank entry examination
a different object with the same identifier value was already associated with the session
Typora使用教程