HDU 1038(速度里程计算 **)

题意是已知车轮的直径,圈数和时间,求所行驶的里程和速度。

单位换算,代码如下:

 1 #include <bits/stdc++.h>
 2 using namespace std;
 3 const double pi = 3.1415927;
 4 double d,t,s,v;
 5 int c,cnt;
 6 int main()
 7 {
 8     while(~scanf("%lf%d%lf",&d,&c,&t))
 9     {
10         if(c==0) break;
11         s = d*pi*c/12/5280;
12         v = s*3600/t;
13         printf("Trip #%d: %.2lf %.2lf
",++cnt,s,v);
14     }
15     return 0;
16 }
View Code
原文地址:https://www.cnblogs.com/Taskr212/p/9565658.html