sicily 1051. Biker's Trip Odomete
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的更多相关文章
- HDU 1038 - Biker's Trip Odometer
算一下路程和速度... #include <iostream> #include <cstdio> using namespace std; const double p=3. ...
- Sicily 1051: 魔板(BFS+排重)
相对1150题来说,这道题的N可能超过10,所以需要进行排重,即相同状态的魔板不要重复压倒队列里,这里我用map储存操作过的状态,也可以用康托编码来储存状态,这样时间缩短为0.03秒.关于康托展开可以 ...
- hdu 1038 Biker's Trip Odometer(水题)
题目链接:http://acm.hdu.edu.cn/showproblem.php? pid=1038 Biker's Trip Odometer Time Limit: 2000/1000 MS ...
- 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 ...
- dir命令只显示文件名
dir /b 就是ls -f的效果 1057 -- FILE MAPPING_web_archive.7z 2007 多校模拟 - Google Search_web_archive.7z 2083 ...
- HOJ题目分类
各种杂题,水题,模拟,包括简单数论. 1001 A+B 1002 A+B+C 1009 Fat Cat 1010 The Angle 1011 Unix ls 1012 Decoding Task 1 ...
- 杭电OJ--自行车计速器
Biker's Trip Odometer Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Ot ...
- OJ题解记录计划
容错声明: ①题目选自https://acm.ecnu.edu.cn/,不再检查题目删改情况 ②所有代码仅代表个人AC提交,不保证解法无误 E0001 A+B Problem First AC: 2 ...
- HDOJ 1051. Wooden Sticks 贪心 结构体排序
Wooden Sticks Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) To ...
随机推荐
- 使用nginx的ngx_upstream_jdomain模块实现k8s容器的负载均衡
使用背景最近一直在准备k8s上线事宜,目前已经在测试环境中全面部署并通过压力测试环境检验.离正式上线基本只剩下时间问题.我们目前测试环境中的容器负载均衡大量使用到了nginx,就是借助了ngx_ups ...
- 服务器安全策略之《启用Windows 防火墙情况下配置允许SQL Server远程连接》
为了服务器的安全,通常情况下我们需要启用Windows 防火墙,然而在启用了Windows 防火墙后会发现会引发一系列的问题,比如无法通过本地远程服务器桌面.无法在本地远程连接SQL Server等, ...
- centos7 源码构建、安装dubbo-monitor
按照官方文档 ,发现dubbo-monitor-simple-x.x.x-assembly.tar.gz 下载不下来(地址访问不了),那么就自己下载源码构建吧. 我的zookeeper,hadoop ...
- HIIT训练第一波,值得收藏的训练计划
下面这三套训练,收藏好,平时在家或者出差都能用! 即使你是一个健身新手,也并不意味着高强度间歇训练(HIIT)不适合你. 这种快节奏的训练已经显露出短时间内燃烧成吨卡路里的能力.所以,你并不需要再健身 ...
- VBS 重启 TP-Link 路由器
分享一个自己用的小工具,重启TP-Link路由器的,好像还是大学时候写的,献丑了. 其他路由器可能有些不同,但是思路都是差不多的. user = "admin" '路由器帐号 pa ...
- Vue 表格内容根据后台返回状态位填充文字
本文地址:http://www.cnblogs.com/veinyin/p/8534365.html Vue 做表格时我们常用的就是 v-for ,直接把 prop 绑定上去,但是如果表格内容需要我 ...
- 微服务深入浅出(7)-- 网关路由Zuul
Zuul用于构建边界服务,致力于动态路由,过滤,监控,弹性伸缩和安全等方向. 1.Zuul+Ribbon+Eureka结合,可以实现智能路由和负载均衡 2.网关将所有服务的API接口统一聚合统一暴露 ...
- Java 对象初始化生命周期
class Man { String name; int age = 20; public static int sex = 1; Man(String name, int age) { //supe ...
- Django中html里的分页显示
分页一(very low) 因为数据量过大,而又想直观便捷的查看数据,进而通过分页显示就可以完成这项工作 app中views.py LIST=[] #全局定义一个LIST for i in range ...
- Ubuntu 增加全新硬盘 分区及开机自动挂载
安装新的硬盘后.可以安装Gparted, 或者从live cd启动,然后用Gparted工具对硬盘进行分区.然后进入系统,启动Disks, 找到对应硬盘, 选择Edit Mount Options, ...