首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

URAL - 1740 - Deer is Better

2013-09-05 
URAL - 1740 - Deer is Better!题意:一只驴每h小时走k千米,现要走l千米,问这只驴最少用时与最长用时(1 ≤ k

URAL - 1740 - Deer is Better!

题意:一只驴每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;}


热点排行