只有50分,请大佬们帮忙给看看呗,谢谢啦!

P5707 【深基2.例12】上学迟到

resea @ 2024-01-03 09:50:02

#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    float a,b;
    int c,h,m;
    cin>>a>>b;
    c=ceil(a/b);
    h=7-c/60;
    if (h==0) h=12;
    if (h<0) h=h+12;
    m=50-c%60;
    if (m<0)
    {
        m=m+60; 
    }
    if(h<10) cout<<"0"<<h;
    else cout<<h;
    cout<<":";
    if(m<10) cout<<"0"<<m;
    else cout<<m;
    return 0;   
}

by ALPHA_wule @ 2024-01-03 10:15:39

1.用double存 2.判断是否是前一天 3.输出用fixed<<setprcision(x)<<值<<endl;


|