题解 | #牛牛的时钟#

牛牛的时钟

https://www.nowcoder.com/practice/36fd5f6b6236452f99f0ea59cd3447e0

#include <stdio.h>

typedef struct{
    int s;
    int m;
    int h;
}time;

int main() {
    time now;
    now.h=0;
    now.m=0;
    now.s=0;
    int n;
    scanf("%d",&n);
    int a[n];
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
    }
    int sum=0;
    for(int i=0;i<n;i++){
        sum=sum+a[i];
        now.s=sum%60;
        now.m=sum%3600/60;
        now.h=sum/3600;
        printf("%d %d %d\n",now.h,now.m,now.s);

    }


    return 0;
}

全部评论

相关推荐

04-29 22:35
门头沟学院 Java
牛友说改了名字能收到offer:旧图新发查看图片
点赞 评论 收藏
分享
喜欢核冬天的哈基米很想上市:会爆NullPointerException的
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务