#include <stdio.h> int main() { int list1[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int list2[13] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int year, numday; while (scanf("%d %d", &year, &numday) != EOF) { int month = 0; int day; if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0) { for (int i = 0; i <= 12; i++) { day = numday; numday = numday - list2[i]; if (numday > 0) { month++; } else { break; } } } else { for (int i = 0; i <= 12; i++) { day = numday; numday = numday - list1[i]; if (numday > 0) { month++; } else { break; } } } printf("%4d-%02d-%02d", year, month, day); } }