#include <stdio.h> #include <stdlib.h> typedef struct Time { unsigned char hour; unsigned char min; unsigned char sec; } ti_t; void setTime(ti_t* Tt, unsigned short sec) { int flags = Tt->sec + sec >= 60 ? 1 : 0; if (1 == flags) { Tt->min += (Tt->sec + sec) / 60; Tt->sec = (Tt->sec + sec) % 60; if (Tt->min >= 60) { Tt->hour += Tt->min / 60; Tt->min = Tt->min % 60; } } else { Tt->sec = Tt->sec + sec; } } int main() { int n; scanf("%d", &n); ti_t stock = { .hour = 0, .min = 0, .sec = 0 }; int tmp[n]; for (int i = 0; i < n; i++) { scanf("%d", &tmp[i]); } for (int i = 0; i < n; i++) { setTime(&stock, tmp[i]); printf("%d %d %d\n", stock.hour, stock.min, stock.sec); } return 0; }