hdoj 2033 人见人爱

人见人爱A+B

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 35479    Accepted Submission(s): 23702


Problem Description
HDOJ上面已经有10来道A+B的题目了,相信这些题目曾经是大家的最爱,希望今天的这个A+B能给大家带来好运,也希望这个题目能唤起大家对ACM曾经的热爱。
这个题目的A和B不是简单的整数,而是两个时间,A和B 都是由3个整数组成,分别表示时分秒,比如,假设A为34 45 56,就表示A所表示的时间是34小时 45分钟 56秒。
 

Input
输入数据有多行组成,首先是一个整数N,表示测试实例的个数,然后是N行数据,每行有6个整数AH,AM,AS,BH,BM,BS,分别表示时间A和B所对应的时分秒。题目保证所有的数据合法。
 

Output
对于每个测试实例,输出A+B,每个输出结果也是由时分秒3部分组成,同时也要满足时间的规则(即:分和秒的取值范围在0~59),每个输出占一行,并且所有的部分都可以用32位整数表示。
 

Sample Input
  
  
2 1 2 3 4 5 6 34 45 56 12 23 34
 

Sample Output
  
  
5 7 9 47 9 30
 

Author
lcy




#include<iostream>
#include<cstdio>
#include<string>
#include<sstream>
#include<cstdlib>
#include<cstring>
#include<cctype>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<deque>
#include<cmath>
#include<climits>
#include<list>
#include<utility>
#include<memory>
#include<cstddef>
#include<iterator>

using namespace std;
typedef long long LL;
const double pi = acos(-1.0);
///





///
int main(int argc, char**argv) {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	
	
	int times;
	cin >> times;
	while (times--) {
		int h1, m1, s1;
		int h2, m2, s2;
		int h3 = 0, m3 = 0, s3 = 0;
		cin >> h1 >> m1 >> s1;
		cin >> h2 >> m2 >> s2;
		s3 = s1 + s2;
		if (s3 >= 60) {
			m2++;
			s3-= 60;
		}
		m3 =m3+ m2 + m1;
		if (m3 >= 60) {
			h3++;
			m3 -= 60;
		}
		h3 = h1 + h2 + h3;
		cout << h3<<" " << m3<<" " << s3 << endl;
	}



	
	//system("pause");
	return 0;
}







  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值