3 条题解

  • 0
    @ 2021-04-02 21:14:01
    #include<iostream>
    using namespace std;
    int main()
    {
        int hour,minute,second; cin>>hour>>minute>>second;
        int hour1,minute1,second1; cin>>hour1>>minute1>>second1;
        int cnt=0;
        while(hour1!=hour||minute1!=minute||second!=second1)
        {
            second++;
            if(second>60)
            {
                second=1;
                minute++;
            }
            if(minute>60)
            {
                minute=1;
                hour++;
            }
            cnt++;
        }
        cout<<cnt;
        return 0;
    }
    
  • 0
    @ 2019-03-31 13:21:52
    #include <iostream>
    using namespace std;
    class Time
    {
        int hour;
        int minute;
        int second;
    public:
        void init(int h, int m, int s)
        {
            hour = h;
            minute = m;
            second = s;
        }
        int TimetoZero()
        {
            return (60 - second) + 60 * (59 - minute) + 3600 * (23 - hour);
        }
    };
    int main()
    {
        int h1, m1, s1;     cin >> h1 >> m1 >> s1;
        int h2, m2, s2;     cin >> h2 >> m2 >> s2;
        Time t1, t2;
        t1.init(h1, m1, s1);
        t2.init(h2, m2, s2);
        cout << t1.TimetoZero() - t2.TimetoZero();
        return 0;
    }
    
  • -1

    #include <iostream>
    using namespace std;
    int main()
    {
    int t11,t12,t13;
    int t21,t22,t23;
    cin>>t11>>t12>>t13;
    cin>>t21>>t22>>t23;

    if(t11<=24&&t21<=24&&t12<=60&&t22<=60&&t13<=60&&t23<=60)
    {
    t11=t11*3600;t21=t21*3600;
    t12=t12*60;t22=t22*60;
    t13=t11+t12+t13;t23=t21+t22+t23;
    }

    if(t13<t23)
    t13=t23-t13;
    else
    t13=t13-t23;

    cout<<t13;

    return 0;
    }

  • 1

信息

ID
1001
难度
5
分类
(无)
标签
递交数
788
已通过
280
通过率
36%
被复制
6
上传者