其他分享
首页 > 其他分享> > 2021CCCC天梯赛L1-075

2021CCCC天梯赛L1-075

作者:互联网

#include<iostream>
using namespace std;

int main()
{
    string s;
    cin>>s;
    if(s.size()==4)
    {
        int a=stoi(s.substr(0,2));
        int b=stoi(s.substr(2,2));
        if(a<=21)printf("20%02d-%02d",a,b);
        else printf("19%02d-%02d",a,b);
    }
    else
    {
        int a=stoi(s.substr(0,4));
        int b=stoi(s.substr(4,2));
        printf("%04d-%02d",a,b);
    }
    return 0;
}

标签:std,075,2021CCCC,int,substr,stoi,L1,main
来源: https://blog.csdn.net/weixin_51928751/article/details/121447289