90分?第10数据点未过……

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

Eric1012 @ 2024-02-23 20:25:56

#include <bits/stdc++.h>
using namespace std;
int main(){
    int s,v,t=10;
    cin>>s>>v;
    if(v<s) t=s%v==0?t+s/v:t+s/v+1;
    if(t<=480){
        int ts=t/60;
        int tf=t-ts*60;
        if(60-tf>=10)cout<<"0"<<7-ts<<":"<<60-tf;
        else cout<<"0"<<7-ts<<":"<<"0"<<60-tf;
    }
    else if(t>480&&t<=1080){
        t=t-480;
        int ts=t/60;
        int tf=t-ts*60;
        if(60-tf>=10)cout<<23-ts<<":"<<60-tf;
        else cout<<23-ts<<":"<<"0"<<60-tf;
        }
    else{
        t=t-1080;
        int ts=t/60;
        int tf=t-ts*60;
        if(60-tf>=10)cout<<"0"<<9-ts<<":"<<60-tf;
        else cout<<"0"<<9-ts<<":0"<<60-tf;
    }
}

求救思密达


by 11514zbs @ 2024-02-23 21:12:08

那么复杂?不用吧?

#include <bits/stdc++.h>
using namespace std;
int main()
{
    int s, v, t1, t2, t3;
    cin >> s >> v;
    if (s % v != 0)
    {
        t1 = s / v + 11;
    }
    else
    {
        t1 = s / v + 10;
    }
    t2 = (31 - t1 / 60) % 24;
    t3 = 60 - t1 % 60;
    printf("%02d:%02d", t2, t3);
    return 0;
}

话说这题好不珂学啊


by 11514zbs @ 2024-02-23 21:17:27

tj里的大佬想得都好复杂啊,本蒟蒻都看不懂。。。


by 11514zbs @ 2024-02-23 21:17:50

@Eric1012 求关QWQ


|