大老们 哪里出错了啊 我感觉没问题啊

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

Allen_teacher @ 2023-09-25 14:09:53

- #include <iostream>
- using namespace std;

- int main(){
    - int s,v,h,m,t;
    - cin >>s >>v;
    - if(s%v){
        - t = s/v + 1;
    - } else{
        - t = s/v;
    - }
    - t = 8*60 - 10 - t;
    - h = t/60;
    - m = t-h*60;
    - cout <<0 <<h <<':';
    - if(m<10){
        - cout <<0;
    - }
    - cout <<m;
    - return 0;
- }

by xiaoxiaoyyds @ 2023-09-25 14:21:52

@Allen_teacher h可能大于10,你这样写会多输出0


|