测试都对,提交只有70分

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

Wyr333 @ 2023-09-19 12:59:49

#include<bits/stdc++.h>
using namespace std;

int main()
{
    double s,u,b,n,r;
    int a,t,w;
    cin>>s>>u;
    a=8;
    b=ceil(s/u)+10;
    n=ceil(b/60);
    w=a-n;
    r=b-(n-1)*60;
    t=60-r;
    if(w<10)
    {
        if(t<10)
        {
            cout<<"0"<<w<<":"<<"0"<<t<<endl;
        }
        else cout<<"0"<<w<<":"<<t<<endl;
    }
    if(w<0)
    {
        if(t<10)
        {
            cout<<w+24<<":"<<"0"<<t<<endl;
        }
        else cout<<w+24<<":"<<t<<endl;
    }
    return 0;
}

明明测试都对,已提交只有70分


by GoodLuckCat @ 2023-09-19 13:26:58

@Wyr333

#include<bits/stdc++.h>
using namespace std;

int main()
{
    double s,u,b,n,r;
    int a,t,w;
    cin>>s>>u;
    a=8;
    b=ceil(s/u)+10;
    n=ceil(b/60);
    w=a-n;
    r=b-(n-1)*60;
    t=60-r;
    if(w<0)
    {
        w+=24;
    }
    if(w<10)
    {
        if(t<10)
        {
            cout<<"0"<<w<<":"<<"0"<<t<<endl;
        }
        else cout<<"0"<<w<<":"<<t<<endl;
    }
    else
    {
        if(t<10)
        {
            cout<<w<<":"<<"0"<<t<<endl;
        }
        else cout<<w<<":"<<t<<endl;
    }
    return 0;
}

by futurenitian @ 2023-09-19 20:52:48

这个还需要满足跨越一天的可能,有可能s/v>480需要重新编程


|