80分求助

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

Luogugares_75 @ 2024-11-22 13:01:40

求助!!

#include<bits/stdc++.h>
using namespace std;
int s,v,i;
int main()
{
    cin>>s>>v;
    int t=32*60-10-(s+v-1)/v;
    int h=t/60%24,m=t%60;
    cout<<h/10<<h%10<<":"<<m/10<<h%10;
    return 0;
}

QWQ


by wuyusheng @ 2024-11-22 13:11:30

@Luogugares_75

#include<bits/stdc++.h>
using namespace std;
int main()
{
    double s,v;
    cin>>s>>v;
    int m=8*60+24*60;
    int t=ceil(s/v)+10;
    m=m-t;
    if(m>60*24)
    m=m-60*24;
    int g=m%60;
    int h=ceil(m/60);
    if(h<10)
    {
        if(g<10) cout<<"0"<<h<<":0"<<g;
        else cout<<"0"<<h<<":"<<g;
    }
    else
    {
        if(g<10) cout<<h<<":0"<<g;
        else cout<<h<<":"<<g;
    }
}

好像没这么简单吧?


by Luogugares_75 @ 2024-11-22 13:51:47

@wuyusheng

谢啦


|