70分求助qwq

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

ZeroCore @ 2023-09-06 13:58:22

#include<iostream>
using namespace std;

int main()
{
    int s,v;
    cin>>s>>v;
    int time=s/v+10;
    if(s%v!=0)  time++;
    time=480-time;
    int h=time/60,m=time%60;

    cout.width(2);
    cout.fill('0');
    cout<<h<<':';
    cout.width(2);
    cout<<m;

    cin.get();cin.get();
    return 0;
}

by lao_wang @ 2023-09-06 14:22:32

#include<bits/stdc++.h>
using namespace std ;
int u , m , h=8 , k=0 ;
int main() {
    cin >> u >> m ;
    k = k-(u+m-1)/m-10 ;
    h = h-(abs(k)+59)/60 ;
    if(h<0) h = 24-abs(h) ;
    k = 60-abs(k)%60 ;
    if(h<10) cout << 0 ;
    cout << h << ":" ;
    if(k<10) cout << 0 ;
    cout << k ;
    return 0 ;
}

|