题解 | #牛牛的时钟#
牛牛的时钟
https://www.nowcoder.com/practice/36fd5f6b6236452f99f0ea59cd3447e0
#include <stdio.h> typedef struct time { int hour; int minute; int second; }time; int main() { int n; scanf("%d",&n); //scanf("%d",&t); int t[n]; time time[n]; int i; for(i=0;i<n;i++) { scanf("%d",&t[i]); if(i>0) t[i]+=t[i-1]; } for(int j=0;j<n;j++) { int min=0; int sec=0; int hour=0; hour=t[j]/3600; min=t[j]/60%60; sec=t[j]%60; time[j].hour=hour; time[j].minute=min; time[j].second=sec; } for(int k=0;k<n;k++) { printf("%d %d %d\n",time[k].hour,time[k].minute,time[k].second); } return 0; }