yi ge dian WA : #9 qiou zhu!

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

a12345202303 @ 2024-07-20 14:13:00

#include<iostream>
using namespace std;
int main(){
    int s,v,th,ts,a,t;
    cin>>s>>v;
    t=s/v+1;
    th=7;
    ts=50-t;
    for(int n=0;n!=1;){
        if(ts<0)
            a=1;
        if(a==1)
            ts=ts+60;
        if(a==1)
            th=th-1;
        a=0;
        //cout<<"1"<<th<<" "<<ts<<endl;
        if(th<0)
            th=th+24;
        //cout<<"2"<<th<<" "<<ts<<endl;
        if(th>=0)
            if(ts>=0)
                n=1;
        //cout<<"3"<<th<<" "<<ts<<endl;
    }
    if(th<10)
        cout<<"0";
    cout<<th<<":";
    if(ts<10)
        cout<<"0";
    cout<<ts;
    return 0;
}

by chen__yu @ 2024-07-20 14:43:02

@a12345202303 应将\ t=s/v+1;\ 改为\ t=s/v+(s%v!=0);


by a12345202303 @ 2024-07-20 18:25:29

谢谢


|