JustOj 1910: 人见人爱A+B

[提交][状态][讨论版]

题目描述

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

输入

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

输出

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

样例输入
1
1 2 3 4 5 6
样例输出
5 7 9

题解:莫得撒子说的了

 1 #include <iostream>
 2 #include <algorithm>
 3 #include <cstring>
 4 #include <cstdio>
 5 #include <vector>
 6 #include <cstdlib>
 7 #include <iomanip>
 8 #include <cmath>
 9 #include <ctime>
10 #include <map>
11 #include <set>
12 using namespace std;
13 #define lowbit(x) (x&(-x))
14 #define max(x,y) (x>y?x:y)
15 #define min(x,y) (x<y?x:y)
16 #define MAX 100000000000000000
17 #define MOD 1000000007
18 #define pi acos(-1.0)
19 #define ei exp(1)
20 #define PI 3.141592653589793238462
21 #define INF 0x3f3f3f3f3f
22 #define mem(a) (memset(a,0,sizeof(a)))
23 typedef long long ll;
24 ll gcd(ll a,ll b){
25     return b?gcd(b,a%b):a;
26 }
27 const int N=2005;
28 const int mod=1e9+7;
29 int main()
30 {
31     std::ios::sync_with_stdio(false);
32     int n;
33     cin>>n;
34     while(n--){
35         int x1,x2,y1,y2,z1,z2;
36         cin>>x1>>y1>>z1>>x2>>y2>>z2;
37         int x=0,y=0,z=0;
38         if(z1+z2>=60) y++;
39         z=(z1+z2)%60;
40         if(y+y1+y2>=60) x++;
41         y=(y+(y1+y2))%60;
42         x=(x+(x1+x2))%60;
43         cout<<x<<" "<<y<<" "<<z<<endl;
44     }
45     return 0;
46 }

 
时间: 2024-08-30 17:36:15

JustOj 1910: 人见人爱A+B的相关文章

人见人爱A^B nefu 444

人见人爱A^B Problem : 444 Time Limit : 1000ms Memory Limit : 65536K description 求A^B的最后三位数表示的整数. 说明:A^B的含义是“A的B次方” input 输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1<=A,B<=10000),如果A=0, B=0,则表示输入数据的结束,不做处理. output 对于每个测试实例,请输出A^B的最后三位表示的整数,每个输出占一行. sample_input 2

杭电 2034 人见人爱A-B

http://acm.hdu.edu.cn/showproblem.php?pid=2034 人见人爱A-B Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 43093    Accepted Submission(s): 12090 Problem Description 参加过上个月月赛的同学一定还记得其中的一个最简单的题目,就是{

hdu 2035 人见人爱A^B

人见人爱A^B Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 34306    Accepted Submission(s): 23290 Problem Description 求A^B的最后三位数表示的整数. 说明:A^B的含义是“A的B次方” Input 输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1<=A

人见人爱A^B(杭电2035)(中国剩余定理)

人见人爱A^B Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 23657    Accepted Submission(s): 16417 Problem Description 求A^B的最后三位数表示的整数. 说明:A^B的含义是"A的B次方" Input 输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成

题目1441:人见人爱 A ^ B(二分求幂)

题目链接:http://ac.jobdu.com/problem.php?pid=1441 详解链接:https://github.com/zpfbuaa/JobduInCPlusPlus 参考代码: // // 1441 人见人爱 A ^ B.cpp // Jobdu // // Created by PengFei_Zheng on 15/04/2017. // Copyright © 2017 PengFei_Zheng. All rights reserved. // #include

杭电2035人见人爱A^B

级新生)除了校赛,还有什么途径可以申请加入ACM校队?  人见人爱A^B Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 33751    Accepted Submission(s): 22894 Problem Description 求A^B的最后三位数表示的整数.说明:A^B的含义是“A的B次方” Input 输入数据包含多个测试

hdoj 2035 人见人爱A^B

人见人爱A^B Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 27954    Accepted Submission(s): 19117 Problem Description 求A^B的最后三位数表示的整数.说明:A^B的含义是“A的B次方” Input 输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1<=A,B

航电OJ-2035 人见人爱A^B

人见人爱A^B Problem Description 求A^B的最后三位数表示的整数. 说明:A^B的含义是"A的B次方" Input 输入数据包含多个测试实例,每个实例占一行,由两个正整数A和B组成(1<=A,B<=10000),如果A=0, B=0,则表示输入数据的结束,不做处理. Output 对于每个测试实例,请输出A^B的最后三位表示的整数,每个输出占一行. Sample Input 2 3 12 6 6789 10000 0 0 Sample Output 8

HDU 2034 人见人爱A-B

/* 中文题意: 中文翻译: 题目大意:将a集合中和b集合中相同的全部去除,留下所有和b集合不相同,并将其输出 解题思路:看懂题意,直接写下来就可以了. 难点详解:看清题意,避免不必要的PE错误. 关键点:排序和找到和B集合相同的数如何处理. 解题人:lingnichong 解题时间:2014/07/30    17:39:37 写 解题感受: */ 人见人爱A-B Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/327