zkh745214988 @ 2024-10-27 20:11:50
#include<iostream>
using namespace std;
int main()
{
int m=0,h=8,m_p=0,h_p=0;
float s, v;
cin >> s >> v;
m_p = ceil(s / v);
if (m_p > 8 * 60)
{
h = 24;
m_p -= 8 * 60;
}
if ((m_p+10) > 60)
{
m_p=(m_p+10)%60;
h_p = (m_p+10) / 60;
}
h = h - h_p - 1;
m = 50 - m_p;
if (m < 10&&h<10)
{
cout << 0 << h << ':' << 0 << m;
}
else if(m<10&&h>=10)
{
cout << h << ':' << 0 << m;
}
else if (m >= 10 && h >= 10)
{
cout << h << ':' << m;
}
else if (m >= 10 && h < 10)
{
cout << 0 << h << ':' << m;
}
return 0;
}
by 绿茶tevi @ 2024-10-28 17:08:59
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
int m=0,h=8,m_p=0,h_p=0;
float s, v;
cin >> s >> v;
m_p = ceil(s / v);
if (m_p > 8 * 60)
{
h = 24;
m_p -= 8 * 60;
m_p%=1440;//超出八小时不代表要一定要在前一天出发,上一步的操作很可能大于24小时(比如输入1930 1,所以减去八小时后要将剩余时间控制在24小时以内
}
if ((m_p+10) > 60)
{
m_p=(m_p+10)%60;
h_p = (m_p+10) / 60;
}
h = h - h_p - 1;
m = 60 - m_p;
if (m < 10&&h<10)
{
cout << 0 << h << ':' << 0 << m;
}
else if(m<10&&h>=10)
{
cout << h << ':' << 0 << m;
}
else if (m >= 10 && h >= 10)
{
cout << h << ':' << m;
}
else if (m >= 10 && h < 10)
{
cout << 0 << h << ':' << m;
}
return 0;
}
by zkh745214988 @ 2024-10-28 23:21:19
@绿茶tevi 感谢感谢懂了(原来你也(狗头))