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.

小学计算题……

#include <cstdio>

int main(void) {
#ifdef JDEBUG
freopen("1051.in", "r", stdin);
freopen("1051.out", "w", stdout);
#endif
const double pi = 3.1415927;
const int ipm = * ; // inches per mile
const int sph = * ; // seconds per hour double diameter; // in inches
int revolution;
double time; // seconds
int count = ;
while (scanf("%lf %d %lf", &diameter, &revolution, &time) && revolution != ) {
double miles = diameter * pi * revolution / ipm;
double hours = time / sph;
double mph = miles / hours;
printf("Trip #%d: %.2lf %.2lf\n", count++, miles, mph);
} return ;
}

sicily 1051. Biker's Trip Odomete的更多相关文章

  1. HDU 1038 - Biker's Trip Odometer

    算一下路程和速度... #include <iostream> #include <cstdio> using namespace std; const double p=3. ...

  2. Sicily 1051: 魔板(BFS+排重)

    相对1150题来说,这道题的N可能超过10,所以需要进行排重,即相同状态的魔板不要重复压倒队列里,这里我用map储存操作过的状态,也可以用康托编码来储存状态,这样时间缩短为0.03秒.关于康托展开可以 ...

  3. hdu 1038 Biker&#39;s Trip Odometer(水题)

    题目链接:http://acm.hdu.edu.cn/showproblem.php? pid=1038 Biker's Trip Odometer Time Limit: 2000/1000 MS ...

  4. hdu_1038_Biker's Trip Odometer_201311021643

    Biker's Trip Odometer Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Ot ...

  5. dir命令只显示文件名

    dir /b 就是ls -f的效果 1057 -- FILE MAPPING_web_archive.7z 2007 多校模拟 - Google Search_web_archive.7z 2083 ...

  6. HOJ题目分类

    各种杂题,水题,模拟,包括简单数论. 1001 A+B 1002 A+B+C 1009 Fat Cat 1010 The Angle 1011 Unix ls 1012 Decoding Task 1 ...

  7. 杭电OJ--自行车计速器

    Biker's Trip Odometer Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Ot ...

  8. OJ题解记录计划

    容错声明: ①题目选自https://acm.ecnu.edu.cn/,不再检查题目删改情况 ②所有代码仅代表个人AC提交,不保证解法无误 E0001  A+B Problem First AC: 2 ...

  9. HDOJ 1051. Wooden Sticks 贪心 结构体排序

    Wooden Sticks Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) To ...

随机推荐

  1. php配置修改后,平滑启动php-fpm

    修改了php配置需要平滑启动php-fpm ps -aux | grep php-fpm 找到phpfpm 的master process的进程id kill -SIGUSR2 31158   实现平 ...

  2. python的匿名函数 lambda的使用方法详解以及使用案例

    1.匿名函数是用lambda这个关键字定义 lambda  x:x+1   第一个x代表形参,x+1相当于函数的返回值 #lambda x:x+1 第一个x代表形参,x+1相当于函数的返回值 def ...

  3. ubuntu内核及系统升级

    升级之前,需要先确认ubuntu当前系统版本,使用操作: root@Dy-JXQ-ubuntu-101:~# lsb_release -a No LSB modules are available. ...

  4. Spring Resource 类图

    插播个广告 老丈人家的粉皮儿,农产品,没有乱七八糟的添加剂,欢迎惠顾 

  5. bzoj千题计划127:bzoj1041: [HAOI2008]圆上的整点

    http://www.lydsy.com/JudgeOnline/problem.php?id=1041 设 X>0 ,Y>0 X^2 + Y^2 = R^2 X^2 = R^2-Y^2 ...

  6. 15 Most Read Data Science Articles in 2015. So far …

    15 Most Read Data Science Articles in 2015. So far … We've compiled the latest set of "most rea ...

  7. Web API: Client: HttpClient Message Handlers

    原文地址: http://www.asp.net/web-api/overview/web-api-clients/httpclient-message-handlers using System; ...

  8. asp.net 调用post方法并获取返回值

    /// <summary>        /// http协议 post数据 接受返回结果        /// </summary>        /// <param ...

  9. java中并发Queue种类与各自API特点以及使用场景!

    一 先说下队列 队列是一种数据结构.它有两个基本操作:在队列尾部加入一个元素,和从队列头部移除一个元素(注意不要弄混队列的头部和尾部) 就是说,队列以一种先进先出的方式管理数据,如果你试图向一个 已经 ...

  10. leetcode刷刷刷

    1.链表节点的插入排序(写了个插入排序,但是报段错误,自己编译器里能运行) #include <iostream> #include <stdlib.h> #include & ...