2021团体程序设计天梯赛 L1-3 强迫症

思路:

数字处理

Tip:

注意年月输出用%02d

#include <bits/stdc++.h>

using namespace std;

int main() {
    int a;
    cin >> a;
    int month = a % 100;
    int year = a / 100;
    if (year < 100) {
        if (year < 22)
            printf("20%02d-%02d", year, month);
        else
            printf("19%02d-%02d", year, month);
    } else
        printf("%d-%02d", year, month);
    return 0;
}

  

posted @ 2021-04-27 10:08  Whiteying  阅读(238)  评论(0编辑  收藏  举报