C++卡3,5求助!!!

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

DDV1 @ 2024-07-28 10:09:03

#include<bits/stdc++.h>
using namespace std;
int main(){
    int s,v,add=480;
    cin>>s>>v;
    int y;
    if(s%v==0)
    y=s/v;
    else
    y=s/v+1;
    y=y+10;
    int H=y/60,M=y%60;
    if(y<=480){
        if(M==0)
        cout<<"0"<<8-H<<":00";
        else
        cout<<"0"<<7-H<<":"<<60-M;
    } 
    if(y>480){
        if(M==0 and 24-(H-8)>=10)
        cout<<24-(H-8)<<":00";
        if(M==0 and 24-(H-8)<10)
        cout<<"0"<<24-(H-8)<<":00";
        if(M!=0 and 24-(H-8+1)>=10)
        cout<<24-(H-8+1)<<":"<<60-M;
        if(M!=0 and (24-(H-8+1)<10))
        cout<<"0"<<24-(H-8+1)<<":"<<60-M;
    }
    return 0;
}

我太难了。。。


by leserein9 @ 2024-08-05 19:20:57

试试输入1426 1 然后自己找错误吧


by DDV1 @ 2024-08-06 21:55:48

@leserein9 Thank you


|