2 solutions

  • 1
    @ 2026-2-23 11:27:53
    #include <iostream>
    using namespace std;
    int main() {
        // 1. 读取输入
        int h, m, s, k;
        cin >> h >> m >> s;
        cin >> k;
        s += k;
        m += s / 60;
        s %= 60;
        h += m / 60;
        m %= 60;
        cout << h << " " << m << " " << s;
    return 0;
    }
    
    
    • -1
      @ 2026-1-25 19:10:26
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          int a,b,c,d;
          cin>>a>>b>>c>>d;
          c+=d;
          if(c>=60)
          {
              b+=c/60;
              c%=60;
              if(b>=60)
              {
                  a+=b/60;
                  b=b%60;
              }
          }
          cout<<a<<" "<<b<<" "<<c;
      }
      
      • 1

      Information

      ID
      13
      Time
      1000ms
      Memory
      128MiB
      Difficulty
      6
      Tags
      # Submissions
      29
      Accepted
      12
      Uploaded By