hihihihhh @ 2024-11-12 15:26:25
#include <stdio.h>
#include <math.h>
int main() {
int s = 100;
int v = 99;
int sum = 480;
scanf("%d %d", &s, &v);
sum = 10 + (int)floor(s * 1.0 / v) + 1;
int hour, min = 0;
int Hour = 0;
int Min = 0;
hour = sum / 60;
min = sum % 60;
Min = 60 - min;
if (hour / 24 != 0)
hour %= 24;
if (hour == 0 || hour < 8)
Hour = 8 - hour - 1;
else if (hour >= 8 && hour < 24)
Hour = 24 - (hour - 8) - 1;
if (min == 0) {
Hour++;
Min = 0;
}
if (Hour == 24)
Hour = 0;
printf("%02d:%02d", Hour, Min);
return 0;
}
谢谢谢谢
by hihihihhh @ 2024-11-12 15:30:52
解决了,我把floor那部分换成ceil向上取整又把+1删了,直接过了