当前位置: 代码迷 >> 综合 >> URAL - 1740 - Deer is Better!
  详细解决方案

URAL - 1740 - Deer is Better!

热度:33   发布时间:2024-01-10 13:19:19.0

题意:一只驴每h小时走k千米,现要走l千米,问这只驴最少用时与最长用时(1 ≤ k ≤ l ≤ 1000; 1 ≤ h ≤ 1000)。

题目链接:http://acm.timus.ru/problem.aspx?space=1&num=1740

——>>每h小时走k千米,可极限为第0.00000...001秒走了k千米或者最后0.00000...001秒走了k千米,这样就是多一个h与少一个h的问题了~

#include <cstdio>
#include <cmath>using namespace std;int main()
{double l, k, h;while(scanf("%lf%lf%lf", &l, &k, &h) == 3) printf("%.8lf %.8lf\n", floor(l / k) * h, ceil(l / k) * h);return 0;
}