3 条题解

  • 0
    @ 2024-10-13 11:00:57
    #include <iostream>
    #include <iomanip>
    using namespace std;
    int main()
    {
        int h1,h2,m,s,a;
        cin>>h1>>m>>s>>a;
        double x;
        s+=a;
        if(s>=60){
            m+=s/60;
            s=s%60;
        }
        if(m>=60){
            h1+=m/60;
            m=m%60;
        }
        h1%=24;
        h2=h1%12;
        if(h2==0||h2==12){
            h2=12;
        }
        cout<<h2<<":"<<m<<":"<<s;
        if(h1>=12){
            cout<<"pm"<<endl;
        }else{
            cout<<"am"<<endl;
        }
        cout<<fixed<<setprecision(2)<<1.0*a*100/86400<<"%";
        return 0;
    }
    
    • 0
      @ 2024-10-13 10:08:14

      #include<iostream> #include<iomanip> using namespace std; int main(){ int h , m , s , t; cin >> h >> m >> s >> t; s = t + s; m = s / 60 + m; h = m / 60 + h; bool a; if(h % 24 < 12){ a = true; }else{ a = false; } if(h % 24 == 0 || h % 24 == 12){ cout << 12 << ":"; }else{ cout << h % 12 << ":"; } cout << m % 60 << ":" << s % 60; if(a){ cout << "am"; }else{ cout << "pm"; } cout << endl; cout << fixed << setprecision(2) << 1.0 * t / 3600 / 24 * 100 << "%";

      return 0;
      

      }

      • 0
        @ 2024-10-7 16:54:40

        #include <iostream> #include <iomanip> using namespace std; int main(){ int a,b,c,d,e; double f; cin>>a; cin>>b; cin>>c; cin>>d; f=d; a+=d/3600; b+=d%3600/60; c+=d%60; if(c>59){ b+=c/60; } if(d>59){ a+=b/60; } if(a0){ a=12; e=1; } if(a>12){ a-=12; e=0; } if(e1){ cout<<a<<":"<<b<<":"<<c<<"am"<<endl; } else{ cout<<a<<":"<<b<<":"<<c<<"pm"<<endl; } cout<<fixed<<setprecision(2)<<f/86400*100<<"%"; }

        • 1

        信息

        ID
        32
        时间
        1000ms
        内存
        256MiB
        难度
        9
        标签
        递交数
        423
        已通过
        45
        上传者