我到底哪个地方不对啊,90分

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

Mr_luo @ 2024-02-05 17:44:11

#include<iostream>
int s,v,total,timer;
int  main()
{
    std::cin>>s>>v;
    if(s/v!=0){
        timer=s/v+11;
    }else timer=s/v+10;
    if(timer>8*60) total=24*60-(timer-8*60);
    else total=8*60-timer;
    int a=total/60,b=total%60;
    if(a<10){
        if(b<10) std::cout<<'0'<<a<<":0"<<b;
        else std::cout<<'0'<<a<<':'<<b;
    }
    else {
        if(b<10) std::cout<<a<<":0"<<b;
        else std::cout<<a<<':'<<b;
    }
    return 0;
}

by Mr_luo @ 2024-02-05 17:46:30

第九个测试点就是过不了,救救孩子吧


by Ryzen_9_7950X @ 2024-02-14 09:20:11

@Mr_luo 第六行你的\ if(s/v!=0){\ 应为\ if(s%v!=0){


by Mr_luo @ 2024-02-14 21:57:59

@Ryzen_9_7950X 好的,谢谢了


by wxcxf @ 2024-02-19 17:37:01

@Mr_luo 9494


|