70分求助!!#7 #8 #10 WA
查看原帖
70分求助!!#7 #8 #10 WA
526922
coool楼主2023/8/12 21:59
#include <bits/stdc++.h>
using namespace std;

double s, v;

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    cin >> s >> v;

    // 先计算出总分钟数
    int t = 8 * 60 + 24 * 60 - 10;
    int tt = ceil(s / v); // ceil向上取整,floor向下取整
    t -= tt;              // 剩下的分钟数

    int h = t / 60;
    int m = t % 60;

 

    if (h > 8)
    {
        if (h > 24)
        {
            h = h-24;
        }
        else h = 32 - h;
    }
    else
        h = 8 - h;
    
    string ansh, ansm;
    if (h >= 10)
        ansh = to_string(h);
    else
        ansh = "0" + to_string(h);

    if (m >= 10)
        ansm = to_string(m);

    else
        ansm = "0" + to_string(m);

    cout << ansh << ":" << ansm << endl;
    return 0;
}
2023/8/12 21:59
加载中...