求助!!为什么有一个测试点过不去

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

wuhanshenzuishuai @ 2024-12-19 23:52:41

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int s,v,min,hour,minute;
    cin>>s>>v;
    if(s%v==0) min=s/v+10;
    else min=s/v+1+10;
    hour=min/60;
    minute=min%60;
    int sthour=8,stminute=0;
    if(stminute-minute<0)
    {
        stminute+=60;
        sthour-=1;
    }
    if(sthour-hour<0)
        sthour+=24;
    if(sthour-hour>0&&sthour-hour<=9){
        if(stminute-minute>=0&&stminute-minute<=9)
    cout<<0<<sthour-hour<<':'<<0<<stminute-minute;
        else cout<<0<<sthour-hour<<':'<<stminute-minute;
    }
    else {
        if(stminute-minute>=0&&stminute-minute<=9)
        cout<<sthour-hour<<':'<<0<<stminute-minute;
        else
            cout<<sthour-hour<<':'<<stminute-minute;
    }
return 0;
}

by markeoeitwupp @ 2024-12-20 10:03:01

输入

469 1

结果不对


by markeoeitwupp @ 2024-12-20 10:04:03

19行>=0


by wuhanshenzuishuai @ 2024-12-20 15:14:00

@markeoeitwupp通过了 感谢大佬!!


|