c++70分求助

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

Im_Joker @ 2023-11-06 22:16:46

#include<iostream>
#include<cmath>
using namespace std;
int main(){
    int h,m=480,s,u;
    scanf("%d %d",&s,&u);
    if(s%u==0){
        m-=s/u;
    }else{
        m-=s/u;
        m--;
    }
    m-=10;
    h=m/60;
    m%=60;
    printf("%02d:%02d",h,m);
    return 0;
}

by Lg2307 @ 2023-11-06 22:24:17

@ZhxInLuogu 计算部分出了问题。


by Im_Joker @ 2023-11-06 22:28:49

@Lg2307 感谢,m应为1920.


|