GDUT_CYH @ 2024-01-25 10:41:48
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
double s = 0; //米
double v = 0; //分钟
cin >> s >> v;
int time = s / v + 10;//出行时间为分钟制
if (s % v != 0) //出行时间不为整数时,向上取整
{
time++;
}
if (time / 60 < 8)
{
cout << "0" << 7 - ceil(time / 60) << ":" << 60 - time % 60;
}
else if (time / 60 == 8)
{
cout << "00:00" << endl;
}
else //总出行时间超过8小时
{
int left_time = time - 8 * 60;
int left_time_H = left_time / 60;
left_time_H = floor(left_time_H);
int left_time_M = left_time % 60;
if (left_time % 60 >= 50)// 分钟要补 0
{
if (left_time_H > 14) //小时也要补 0
{
cout << "0" << 23 - left_time_H << ":" << "0" << 59 - left_time_M << endl;
}
else //小时不需要补 0
{
cout << 23 - left_time_H << ":" << "0" << 59 - left_time_M << endl;
}
}
else if (left_time_H > 14) //小时要补 0
{
if (left_time % 60 >= 50)// 分钟也要补 0
{
cout << "0" << 23 - left_time_H << ":" << "0" << 59 - left_time_M << endl;
}
else// 分钟不要补 0
{
cout << "0" << 23 - left_time_H << ":" << 59 - left_time_M << endl;
}
}
}
}