xfit @ 2024-10-09 19:51:51
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int s, v;
cin >> s >> v;
int time_garbge = 10;
int time_road = s / v + time_garbge; // 计算结果是分钟,此处先用int,视测试情况更改
int time_road_hour = time_road / 60;
int time_road_min = time_road % 60 + 1;
if (time_road_min == 1)
{
time_road_min = 0;
}
int time_togo_hour = 0;
int time_togo_min = 0;
// 如果消耗时间大于8,说明yyy在前一天已经出发了
// 如果消耗时间小于8,说明yyy是当天出发
if(time_road_hour >= 8)
{
time_togo_hour = 24 + 8 - time_road_hour - 1;
}
else
{
time_togo_hour = 8 - time_road_hour - 1;
}
time_togo_min = 60 - time_road_min;
if (time_togo_min == 60)
{
time_togo_min = 0;
time_togo_hour++;
}
cout << setw(2) << setfill('0') << time_togo_hour << ":" << setw(2) << setfill('0') << time_togo_min;
return 0;
}
by Max_robot @ 2024-10-09 19:53:16
@xfit
#include<bits/stdc++.h>
using namespace std;
int s, v, ans, sum, num, cnt;
int main(){
cin>>s>>v;
ans=s/v;
if(s%v!=0)
ans++;
sum=(480+2880-10-ans)%1440;
num=sum/60;
if(num<10)
cout<<0;
cout<<num<<':';
cnt=sum%60;
if(cnt<10)
cout<<0;
cout<<cnt;
return 0;
}
求关qwq
by xfit @ 2024-10-09 21:17:48
@文锡 已关