码迷,mamicode.com
首页 > 其他好文 > 详细

HDU-2033

时间:2014-09-11 19:18:32      阅读:203      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   ar   2014   div   sp   cti   

/********************************************************************
@file     Main_practise.cpp
@date     2014-9-11
@author   Tiger
@brief    人见人爱A+B
********************************************************************/
#include <cstdio>
#include <cstring>

#define MAX 60

struct sTime
{
    sTime(void) : m_nHou(0), m_nMin(0), m_nSec(0)
    {

    }

    int m_nHou;
    int m_nMin;
    int m_nSec;
};

int main(int argc, const char* argv[])
{
    int nTestCases = 0;
    scanf("%d", &nTestCases);
    while (nTestCases--)
    {
        sTime timeA, timeB;
        scanf("%d%d%d%d%d%d", &timeA.m_nHou, &timeA.m_nMin, &timeA.m_nSec, &timeB.m_nHou, &timeB.m_nMin, &timeB.m_nSec);
        
        timeA.m_nSec += timeB.m_nSec;
        if (timeA.m_nSec >= MAX)
        {
            timeA.m_nMin += timeA.m_nSec/MAX;
            timeA.m_nSec  = timeA.m_nSec%MAX;
        }

        timeA.m_nMin += timeB.m_nMin;
        if (timeA.m_nMin >= MAX)
        {
            timeA.m_nHou += timeA.m_nMin/MAX;
            timeA.m_nMin  = timeA.m_nMin%MAX;
        }

        timeA.m_nHou += timeB.m_nHou;

        printf("%d %d %d\n", timeA.m_nHou, timeA.m_nMin, timeA.m_nSec);
    }

    return 0;
}

 

HDU-2033

标签:style   blog   color   io   ar   2014   div   sp   cti   

原文地址:http://www.cnblogs.com/roronoa-zoro-zrh/p/3967075.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!