Yarn_ball @ 2024-11-14 21:52:30
#include <iostream>
using namespace std;
#include<math.h>
int main()
{
int a, b;
cin >> a >> b;
double min = ceil(a / b) + 10; //上学所用时间
int hour = min / 60; //小时数
int mins = min - (hour * 60)+1; //分钟数
int HH = 7 - hour;
int MM = 60 - mins;
if (HH < 0) //如果用时超过8小时,用24减去超过的时间
{
HH += 24;
}
if (HH < 10 && MM < 10) //使输出符合格式
{
cout << 0 << HH << ':' << 0 << MM << endl;
}
else if(HH < 10 && MM>=10)
{
cout << 0 << HH << ':' << MM << endl;
}
else if (HH >= 10 && MM < 10)
{
cout << HH << ':' << 0 << MM << endl;
}
else if (HH >= 10 && MM >= 10)
{
cout << HH << ':' << MM << endl;
}
system("pause");
return 0;
}
by YangCheny @ 2024-11-16 18:56:05
变量SU!!!
by xiaoyu39198 @ 2024-11-17 13:41:05
double min = ceil((double)a / b) + 10; //上学所用时间 这样试试