题解 | #小乐乐定闹钟#

小乐乐定闹钟

http://www.nowcoder.com/practice/0f7e422e12be4a7f9958ca2a82abc775

int main(){
    int hour = 0;
    int minute = 0;
    int k = 0;
    scanf("%d:%d %d",&hour,&minute,&k);
    if(minute+k%60>=60){
        if((minute+k%60)%60==0)
            printf("%2.d:%.2d",((hour+k/60)+1)%24,0);
        else
        {
            printf("%.2d:%.2d",((hour+k/60)+1)%24,(minute+k%60)%60);
        }
    }
    else
    printf("%.2d:%.2d",(hour+k/60)%24,minute+k%60);
    return 0;
}
全部评论

相关推荐

点赞 收藏 评论
分享
牛客网
牛客企业服务