题目链接: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. 深刻理解this的指向和var 定义的变量的问题

    一般来说,在编程语言里我们常见的变量作用域就是词法作用域与动态作用域(Dynamic Scope),绝大部分的编程语言都是使用的词法作用域.词法作用域注重的是所谓的Write-Time,即编程时的上下 ...

  2. jquery.validate.js自定义表单验证

    $(document).ready(function() { //在下列位置输入页面加载的逻辑代码 $("#inputForm").validate({ rules: { seq: ...

  3. 数据包注入重放工具aireplay-ng

    数据包注入重放工具aireplay-ng   aireplay-ng是aircrack-ng组件包的一个工具.它可以注入和重放数据帧,用于后期的WEP.WPA-PSK破解.它提供九种攻击模式,包括死亡 ...

  4. MD Test

    欢迎使用 MWeb XXX ``` ZFCollectionViewListController.m <script src="https://blog-static.cnblogs. ...

  5. C# EF Attach 与 Entry

    先了解一下 EF 框架的 EntityState 在使用EF框架时, 我们通常都是通过调用 SaveChanges() 方法把增加/修改/删除的数据提交到数据库,但是上下文是如何知道实体对象是增加.修 ...

  6. Jindent——让intellij idea 像eclipse一样生成模版化的javadoc注释

    插件地址 http://plugins.jetbrains.com/plugin/2170?pr=idea 安装方法参考 http://www.cnblogs.com/nova-/p/3535636. ...

  7. VMware vmdk文件打开方法

    打开虚拟机设置——硬盘——映射,把虚拟机磁盘文件vmdk映射到系统中即可!

  8. 2015 年度新增开源软件排名 TOP 100 - 开源中国社区

    2015 年度新增开源软件排名 TOP 100 - 开源中国社区 39.ABTestingGateway http://www.oschina.net/news/69808/2015-annual-r ...

  9. STM32F4XX devices vector table for EWARM toolchain.

    ;/******************** (C) COPYRIGHT 2015 STMicroelectronics ******************** ;* File Name : sta ...

  10. c#开发activex注册问题

    最近使用c#开发activex,遇到一个问题,生成的dll文件在本地可以嵌入到web里面,但是到其他机器上就会出现activex无法加载的情况,页面里面出现一个红色的X.mfc开发的activex是使 ...