思路:
数字处理
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; }