HDU 1038[Biker'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&&r){
		l=d*pi;//inch
		printf("Trip #%d: %.2f %.2f\n",cnt++,l*r/12/5280,l*3600*r/12/5280/t);
	}
	return 0;
}

  

HDU 1038[Biker's Trip Odometer]简单计算

时间: 2024-08-06 11:58:39

HDU 1038[Biker's Trip Odometer]简单计算的相关文章

杭电 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

HDU 1038 - Biker&#39;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;

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

[HDU 4082] Hou Yi&#39;s secret (简单计算几何)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4082 题目大意: 给你n个点,问能最多构成多少个相似三角形. 用余弦定理,计算三个角度,然后暴力数有多少个,更新答案. 代码: 1 #include <cstdio> 2 #include <cmath> 3 #include <algorithm> 4 #include <cstring> 5 #include <vector> 6 #includ

hdu 1201 18岁生日 (简单题)

18岁生日 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 18281    Accepted Submission(s): 5776 Problem Description Gardon的18岁生日就要到了,他当然很开心,可是他突然想到一个问题,是不是每个人从出生开始,到达18岁生日时所经过的天数都是一样的呢?似乎并不全都是这样,所以他

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