int comyear[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0};
int leapyear[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 0};

static void init(){
    for (int i = 1; i <= 12; ++i) {
        comyear[i] *= 24 * 60 * 60 ;
        comyear[13] += comyear[i];
        leapyear[i] *= 24 * 60 * 60;
        leapyear[13] += leapyear[i];
    }
}

static inline bool judgeleap(int year){
    return (year % 100 && year % 4 == 0) || (year % 400 == 0);
}
int main() 
{
    init();
    long long val;
    while (scanf("%lld", &val) != EOF) {
        int year = 1970, month = 1, day = 1;  
        long long cnt = 0;
        int* yearptr;
        while (true) {
            yearptr = judgeleap(year) ? leapyear : comyear;
            if (cnt + yearptr[13] <= val) {
                ++year;
                cnt += yearptr[13];
            } else {
                break;
            }
        }

        yearptr = judgeleap(year) ? leapyear : comyear;
        while (true) {
            if (cnt + yearptr[month] <= val) {
                cnt += yearptr[month++];
            } else {
                break;
            }
        }

        while (true) {
            if (cnt + 60 * 60 * 24 <= val) {
                ++day;
                cnt += 60 * 60 * 24;
            } else {
                break;
            }
        }
        printf("%d %02d %02d\n", year, month, day);
    }
    return 0;
}

shiyang6017
158 声望59 粉丝