zoukankan      html  css  js  c++  java
  • 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 }
    View Code
     
  • 相关阅读:
    乘法DAC一点知识
    #4 判断字符串是否为整数
    #3 不使用循环输出1到100
    #2 判断一个字符串是否包含重复字符
    #22 结语
    #1 组成互不相同且不重复的三位数
    #21 Python异常
    #19 re&jieba模块
    2020国庆正睿笔记
    2019正睿csp-s赛前冲刺
  • 原文地址:https://www.cnblogs.com/wydxry/p/7267772.html
Copyright © 2011-2022 走看看