题目链接: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. java okhttp 发送图片

    @RequestMapping(value="/demo2", method=RequestMethod.POST) @ResponseBody public String dem ...

  2. 020.Zabbix的Actions配置

    一 Action概述 当产生Trigger后,即当触发器条件被满足时,采取一些操作,如发送事件通知,远程执行命令等,需要配置Action.   名称 作用 Trigger 当Trigger的状态从OK ...

  3. JAVA 图形开发中组件对齐方法及界面开发

    /*文章中用到的代码只是一部分,需要源码的可通过邮箱联系我 1978702969@qq.com*/ 在上篇博客中提到了JAVA图形界面开发时的两种布局,流式布局和边框布局. 在实际使用中可能会发现,往 ...

  4. 聊聊zookeeper的分布式锁

    分布式锁就是多台机器,分布在不同的JVM中,这些不同JVM内的方法需要获取一个唯一锁,比如获取锁之后要把数据写入数据库,保证数据在同一时刻只有一台机器写入数据库. 分布式锁的实现有多种实现方法,除了今 ...

  5. Android `AsyncTask`简要分析

    AsyncTask简要分析 经典异步任务:AsyncTask,使用场景有:批量下载,批量拷贝等.官方文档就直接给出了一个批量下载的示例. private class DownloadFilesTask ...

  6. jQuery漏掉的东西

    prop和attr的区别 attr一般都用来设置和操作元素的自定义属性的,而prop一般都是操作元素的内置属性的(尤其是表单元素的操作我们大部分都在使用prop) each 可以遍历jQuery集合中 ...

  7. Oracle的一些初步小东西

    经常要用数据库,让他自己启动的话,开机太慢,所以用命令启动方便点.  1.开启:    在运行中输入cmd,进入控制台,lsnrctl start回车,提示启动监听成功后net start Oracl ...

  8. UEditor 的使用

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

  9. 有向图强连通分量的Tarjan算法和Kosaraju算法

    [有向图强连通分量] 在有向图G中,如果两个顶点间至少存在一条路径,称两个顶点强连通(strongly connected).如果有向图G的每两个顶点都强连通,称G是一个强连通图.非强连通图有向图的极 ...

  10. hashCode()方法与equals()方法

    摘自别人的评论:http://blog.csdn.net/fhm727/article/details/5221792 当向集合Set中增加对象时,首先集合计算要增加对象的hashCode码,根据该值 ...