```c
#include<stdio.h>
int main() {
int s, v;
int t;
int t_hour, t_minutes;
scanf("%d%d", &s, &v);
//除法的倍抛问题
if (s / v == 0) {
t = s / v + 10;
}
else {
t = s / v + 10 + 1;
}
//判断yyy是否需要零点之前出发
//零点之后出发
if (t < 480) {
t_minutes = (480 - t) % 60;
if (t_minutes == 0) {
t_hour = 8 - t / 60;
}
else {
t_hour = 8 - t / 60 - 1;
}
printf("%02d:%02d",t_hour,t_minutes);
}
//零点出发
else if (t == 480) {
printf("00:00");
}
//零点之前出发
else {
t = 24 * 60 - (t - 480);
t_hour = t / 60;
t_minutes = t % 60;
printf("%02d:%02d",t_hour,t_minutes);
}
return 0;
}
```
天呐!我绕了一圈,还简化了一下代码,还是90分!到底错哪了!
by juice88 @ 2024-02-29 00:28:52
耶耶,找到问题的点了
```c
//除法的倍抛问题
if (s / v == 0) {
t = s / v + 10;
}
else {
t = s / v + 10 + 1;
}
```
相信聪明的朋友看出我的问题了,就是s/v应该改为s%v,来判断是否整除。
哈哈不知道写代码的时候脑子在想什么,居然错在了这里。
by juice88 @ 2024-02-29 00:37:29