SOV710 @ 2024-08-11 11:53:24
#include<cstdio>
#include<cmath>
using namespace std;
int s, v, time, hh, mm;
int main() {
scanf("%d%d", &s, &v);
time = 60 * (24 + 8) - ceil((1.0 * (s / v)) + 10);
hh = (time / 60) % 24;
mm = time % 60;
printf("%02d:%02d\n", hh, mm);
return 0;
}
输入100 99,输出07:49,而非07:48,十分困惑,求解
by SOV710 @ 2024-08-11 12:18:23
已解决,第7行ceil函数内部的1.0 (s / v)应拆开写成1.0 s / v,否则s / v先进行整除,输出的是1.000000,而不是浮点数1.010101