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

18030193698a @ 2023-12-14 21:12:56

#include<bits/stdc++.h>
using namespace std;
int a,b,k,l=10,m;
int main()
{
    cin>>a>>b;
    while(k<a){
        k+=b;
        l++;
    }   
    m=l/60;
    l%=60;
    if(l!=0){
        m++;
    }
    m=8-m;
    if(m<0){
        m=-m;
        m=24-m;
    }
    if(m>9){
        cout<<m;
    }else{
        cout<<"0"<<m;
    }
    if(l>9){
        cout<<":"<<60-l;
    }else{
        cout<<":"<<"0"<<60-l;
    }
} 

60分 3,4,5,7测试点没过 求助


by 18030193698a @ 2023-12-14 21:13:16

?


by chao_ti_jie @ 2023-12-14 21:15:17

printf("%02d:%02d"); 了解一下


|