当前位置:网站首页>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;
}
边栏推荐
- Database mysql Foundation
- 5、动态规划---斐波那契数列
- Consul
- 漏洞分析丨HEVD-0x8.IntegerOverflow[win7x86]
- IDEA创建我的第一个项目
- SQL Server 2016 学习记录 --- 集合查询
- 15. Judge whether the target value exists in the two-dimensional array
- 3. Print the linked list in reverse order with the array
- [cloud co creation] enterprise digital transformation, Huawei cloud consulting is with you
- C语言 二级指针详解及示例代码
猜你喜欢

ACM寒假集训#6

Skillfully use NGX_ Lua makes traffic grouping

gcc: error trying to exec 'as': execvp: No such file or directory

6. Double pointer -- the sum of the two numbers of the incremental array is equal to the target number

SuperMap iserver publishing management and calling map services

利用正则表达式从文件路径中匹配文件名

【栈的应用】--- 中缀表达式转后缀表达式

逆元&组合数&快速幂

Multithreading and high concurrency (III) -- source code analysis AQS principle

Sword finger offer
随机推荐
吴雄昂遭Arm罢免内幕:建私人投资公司,损害了股东利益?
IE兼容性问题处理
Match file names from file paths using regular expressions
QT | some summaries of signals and slots
[wechat applet] project practice - lottery application
SQL Server 2016 学习记录 --- 嵌套查询
3. Print the linked list in reverse order with the array
Kubernetes
胡润发布2020中国芯片设计10强民营企业:华为海思竟然没有上榜!
Database mysql Foundation
Install MySQL under centos7, and the online articles are not accurate
在mt6735中添加新的开机logo与开\关机动画
16. String inversion
IDEA创建我的第一个项目
3.用数组逆序打印链表
5. Dynamic programming -- Fibonacci series
PHP generates QR code (learning)
SQL Server 2016 learning records - data update
ogg参数filter的使用问题【急】
阿里云镜像地址