2 条题解

  • 0
    @ 2026-8-7 11:31:51
    using namespace std;
    int main (){
        freopen("time.in", "r", stdin);
        freopen("time.out", "w", stdout);
        int h,m,s;
        int n;
        scanf("The Starting Time is %d:%d:%d.",&h,&m,&s);
        cin >> n;
        s = s + n;
        while(s >= 60){
            s -= 60;
            m++;
        }
        while(m >= 60){
            m -= 60;
            h++;
        }
        while(h >= 24){
            h -= 24;
        }
        printf("%d:%d:%d",h,m,s);
        return 0;
    }
    
    • 0
      @ 2023-10-23 17:10:27

      #include<bits/stdc++.h>

      using namespace std;

      int main()

      {

      freopen("time.in","r",stdin);

      freopen("time.out","w",stdout);

      int h,m,s,shu;

      scanf("The Starting Time is %d:%d:%d./n", &h, &m, &s);

      scanf("%d",&shu);

      s=s+shu; //秒

      m=s/60+m;//超的分

      s=s%60;

      h=(m/60+h)%24;//小时

      m=m%60; // 分

      cout<<h<<":"<<m<<":"<<s<<endl;

      return 0;

      }

      • 1

      信息

      ID
      141
      时间
      1000ms
      内存
      256MiB
      难度
      8
      标签
      (无)
      递交数
      279
      已通过
      46
      上传者