题目链接:http://acm.hdu.edu.cn/showproblem.php?

pid=1038

Biker's Trip Odometer

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 5226    Accepted Submission(s): 3476

Problem Description
Most bicycle speedometers work by using a Hall Effect sensor fastened to the front fork of the bicycle. A magnet is attached to one of the spokes on the front wheel so that it will line up with the Hall Effect switch once per revolution
of the wheel. The speedometer monitors the sensor to count wheel revolutions. If the diameter of the wheel is known, the distance traveled can be easily be calculated if you know how many revolutions the wheel has made. In addition, if the time it takes to
complete the revolutions is known, the average speed can also be calculated.

For this problem, you will write a program to determine the total distance traveled (in miles) and the average speed (in Miles Per Hour) given the wheel diameter, the number of revolutions and the total time of the trip. You can assume that the front wheel
never leaves the ground, and there is no slipping or skidding.
 
Input
Input consists of multiple datasets, one per line, of the form:



diameter revolutions time



The diameter is expressed in inches as a floating point value. The revolutions is an integer value. The time is expressed in seconds as a floating point value. Input ends when the value of revolutions is 0 (zero).
 
Output
For each data set, print:



Trip #N: distance MPH



Of course N should be replaced by the data set number, distance by the total distance in miles (accurate to 2 decimal places) and MPH by the speed in miles per hour (accurate to 2 decimal places). Your program should not generate any output for the ending case
when revolutions is 0.



Constants



For p use the value: 3.1415927.

There are 5280 feet in a mile.

There are 12 inches in a foot.

There are 60 minutes in an hour.

There are 60 seconds in a minute.

There are 201.168 meters in a furlong.
 
Sample Input
26 1000 5
27.25 873234 3000
26 0 1000
 
Sample Output
Trip #1: 1.29 928.20
Trip #2: 1179.86 1415.84
 
Source
 
Recommend
We have carefully selected several similar problems for you:  1036 

pid=1064" target="_blank">1064 1084 1031 1027 

 
题目大意:英文一大堆,没什么详细的含义,总之就是给出直径,圈数以及时间。

求路程和速度。

解题思路:这题主要就是注意单位的换算。

题目中直径给的是inche英尺,给的时间是second秒。可是终于要求的是路程是多少mile英里。速度求的是每hour 小时多少mile英里。仅仅要把单位换算清楚就能够了,还有就是直径和时间是浮点型,圈数是整型。


详见代码。
#include <iostream>
#include <cstdio> using namespace std; #define PI 3.1415927 int main()
{
double d,t;
int q;
double s;
double v;
int flag=1;
while (~scanf("%lf%d%lf",&d,&q,&t))
{
if (q==0)
break;
s=PI*d*q/(5280*12);
t/=3600;
v=s/t;
printf ("Trip #%d: %.2lf %.2lf\n",flag++,s,v);
}
return 0;
}

hdu 1038 Biker&#39;s Trip Odometer(水题)的更多相关文章

  1. hdoj-1038-Biker's Trip Odometer(水题)

    题目真的考验英语 题目链接 需要进行单位的转换 对于Pi用:3.1415927. 5280步相当于1英里. 12英寸相当于1步. 60分钟等于1小时 60秒等于1分钟. 201.168米等于1弗朗.( ...

  2. hdu 4274 Spy&#39;s Work(水题)

    Spy's Work Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total ...

  3. HDU 5832 A water problem(某水题)

    p.MsoNormal { margin: 0pt; margin-bottom: .0001pt; text-align: justify; font-family: Calibri; font-s ...

  4. hdu 2393:Higher Math(计算几何,水题)

    Higher Math Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  5. <hdu - 3999> The order of a Tree 水题 之 二叉搜索的数的先序输出

    这里是杭电hdu上的链接:http://acm.hdu.edu.cn/showproblem.php?pid=3999  Problem Description: As we know,the sha ...

  6. HDOJ/HDU 1256 画8(绞下思维~水题)

    Problem Description 谁画8画的好,画的快,今后就发的快,学业发达,事业发达,祝大家发,发,发. Input 输入的第一行为一个整数N,表示后面有N组数据. 每组数据中有一个字符和一 ...

  7. hdu 1164:Eddy's research I(水题,数学题,筛法)

    Eddy's research I Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others ...

  8. HDU ACM 1073 Online Judge -&gt;字符串水题

    分析:水题. #include<iostream> using namespace std; #define N 5050 char a[N],b[N],tmp[N]; void Read ...

  9. hdu 1754 I Hate It(线段树水题)

    >>点击进入原题测试<< 思路:线段树水题,可以手敲 #include<string> #include<iostream> #include<a ...

随机推荐

  1. redis 相关知识点

    (1)什么是redis? Redis 是一个基于内存的高性能key-value数据库. (有空再补充,有理解错误或不足欢迎指正) (2)Reids的特点 Redis本质上是一个Key-Value类型的 ...

  2. elasticsearch query dsl

    1.match / match_phrase / match_phrase_prefix / multi_match[查询] 1.1 match 它会根据所给的字符串,进行分词,然后去找出,包含这些分 ...

  3. 【原创】MySQL Can't create a new thread报错分析

    今天有两台服务器都出现了Can't create a new thread报错. [故障处理过程] 故障发生后登录服务器,检查mysql进程正常,但登录mysql报下面错误 ERROR 1135 (H ...

  4. UEditor 的使用

    UEditor 的使用 一.UEditor 的使用 官方网站:http://ueditor.baidu.com/website/ 下载地址:http://ueditor.baidu.com/websi ...

  5. HEOI2018翻盘记

    HEOI2018翻盘记 听说依照惯例要写一篇游记?好吧,没有退役,我已经谢天谢地了QAQ.那就用两句歌词做开头吧: "遠い遠い夢の終わり.悪夢に似た現実はもう昔日久远,梦之终结,那犹如噩梦的 ...

  6. Ural 2036. Intersect Until You're Sick of It 计算几何

    2036. Intersect Until You're Sick of It 题目连接: http://acm.timus.ru/problem.aspx?space=1&num=2036 ...

  7. j.u.c系列(04)---之AQS:同步状态的获取与释放

    写在前面 在前面提到过,AQS是构建Java同步组件的基础,我们期待它能够成为实现大部分同步需求的基础.AQS的设计模式采用的模板方法模式,子类通过继承的方式,实现它的抽象方法来管理同步状态,对于子类 ...

  8. Linux/CentOS设置全局代理(http)

    说明:为什么说是http代理,其实这个还不能说是全称走代理,罪名写的区别就是ICMP协议这个设置就无效,只能说是90%的应用都可以使用这个设置来实现代理访问,只有个别不行,比如一些软件根本不走http ...

  9. KVM磁盘镜像qcow2、raw、vmdk等格式区别(转)

    raw(default) the raw format is a plain binary image of the disc image, and is very portable. On file ...

  10. Task.FromResult应用场景举例

    Task.FromResult用来创建一个带返回值的.已完成的Task. 场景一:以同步的方式实现一个异步接口方法 比如有一个接口包含异步方法. interface IMyInterface { Ta ...