A_Mercy @ 2023-08-27 22:18:19
#include<cmath>
using namespace std;
int main() {
int s,v;
int d;
scanf("%d%d",&s,&v);
if(s%v==0){
d=s/v;
}
else{
d=s/v+1;
}
if(d/60>23){
cout<<"08:00"<<endl;
return 0;
}
int minute;
if(50-d%60>=0){
minute=50-d%60;
}
else {
minute=110-d%60;
}
int hour;
if(7-d/60>=0){
hour=7-d/60;
}
else{
hour=31-d/60;
}
if(hour>=10&&minute>=10){
printf("%d:%d",hour,minute);
}
if(hour<10&&minute>=10){
printf("0%d:%d",hour,minute);
}
if(hour>=10&&minute<10){
printf("%d:0%d",hour,minute);
}
if(hour<10&&minute<10){
printf("0%d:0%d",hour,minute);
}
return 0;
}
by gitmeetcat @ 2023-08-28 09:36:31
答案已送达
#include<stdio.h>
#include<math.h>
int main()
{
int s, v, b;
scanf("%d%d", &s, &v);
double a = s * 1.0 / v;
if (fmod(a, 1) != 0) {
b = a + 1;
}
else {
b = a;
}
b = b + 10;
b = 1440 - b;
int h = b / 60 + 8;
int m = b % 60;
if (h >= 24) {
printf("%02d:%02d", h - 24, m);
} else {
printf("%02d:%02d", h, m);
}
}