HDU 1038 - Biker's Trip Odometer

算一下路程和速度...

 1 #include <iostream>
 2 #include <cstdio>
 3 using namespace std;
 4 const double p=3.1415927;
 5 double dia,tim,dis,sped;
 6 int rev;
 7 int main()
 8 {
 9     int k=1;
10     while(cin>>dia>>rev>>tim,rev)
11     {
12         dia/=12*5280;
13         dis=dia*p*rev;
14         sped=dis/tim*60*60;
15         printf("Trip #%d: %.2lf %.2lf\n",k++,dis,sped);
16     }
17 }

HDU 1038 - Biker's Trip Odometer

时间: 2024-11-03 21:46:46

HDU 1038 - Biker's Trip Odometer的相关文章

HDU 1038[Biker&#39;s Trip Odometer]简单计算

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1038 题目大意:给轮子直径,转数,时间.要求输出走过的距离和时速(mile为单位) 关键思想:纯算 代码如下: #include <iostream> using namespace std; #define pi 3.1415927 int main(){ double d,r,t,l; int cnt=1; while(cin>>d>>r>>t&&a

杭电 HDU 1038 Biker&#39;s Trip Odometer

Biker's Trip Odometer Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4745    Accepted Submission(s): 3144 Problem Description Most bicycle speedometers work by using a Hall Effect sensor faste

SOJ 1051 Biker&#39;s Trip Odometer

题目大意:多组测试样例,每组测试样例输入3个数,第一个表示车轮的直径(浮点型,单位英寸),第二个表示车轮的转数(整型),第三个表示花费的时间(浮点型,单位秒). 求解车轮的总路程(单位:英里)和平均速度(单位:英里/每小时). 以"Trip #: distance MPH"的格式输出. 当转数输入为零时,结束程序. 解题思路:本题主要考察单位的转化,具体的转化系数在题目中有给出.求车轮周长的π是3.1415927. 先将直径的英寸单位转化为英里单位,将时间的秒单位转化为小时. 代码如下

HDOJ1038 Biker&#39;s Trip Odometer

Biker's Trip Odometer Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4038    Accepted Submission(s): 2703 Problem Description Most bicycle speedometers work by using a Hall Effect sensor faste

杭电OJ(HDU)-ACM Steps-Chapter Two-《Biker&#39;s Trip Odometer》《Climbing Worm》《hide handkerchief》《Nasty Hac》

1.2.1 Biker's Trip Odometer #include<stdio.h> #include<math.h> const double PI=acos(-1.0); /* 计算题,根据公式做就行,PI*d*r/(12*5280);res1/t*3600; 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

HDU-1038-Biker&#39;s Trip Odometer(C++ &amp;&amp; 提高英语能力!)

Biker's Trip Odometer Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4871    Accepted Submission(s): 3237 Problem Description Most bicycle speedometers work by using a Hall Effect sensor faste

sicily 1051. Biker&#39;s Trip Odomete

DescriptionMost 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

HOJ 题目分类

转自:http://blog.sina.com.cn/s/blog_65f3869301011a1o.html ******************************************************************************* 简单题(包括枚举,二分查找,(复杂)模拟,基础数据结构(栈.队列),杂题等 ****************************************************************************

杭电OJ--自行车计速器

Biker's Trip Odometer Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 2810    Accepted Submission(s): 1922 Problem Description Most bicycle speedometers work by using a Hall Effect sensor fasten