码迷,mamicode.com
首页 > 其他好文 > 详细

POJ 1665

时间:2015-06-10 17:09:16      阅读:83      评论:0      收藏:0      [点我收藏+]

标签:

 1 #include<iostream>//chengdacaizi 08.11.12
 2 #include<iomanip>
 3 #define p 3.1415927
 4 using namespace std;
 5 int main()
 6 {   
 7     int num=1;
 8     double getdistance(double , int );
 9     double getspeed(double , double );
10     double diameter;
11     int revolutions;
12     double time; 
13         double distance;
14     double speed;
15     while(1){
16     cin>>diameter>>revolutions>>time;
17     if(revolutions==0)
18         break;
19     distance = getdistance(diameter,revolutions);
20     speed = getspeed(distance,time);
21     cout<<"Trip #"<<num<<": "<<setiosflags(ios::fixed)<<setprecision(2)<<distance<<" "<<speed<<endl; 
22     num++;
23     }
24     return 0;
25 }
26 double getdistance(double diameter,int revolution)
27 {
28    diameter/=63360;
29    diameter*=p;
30    diameter*=revolution;
31    return diameter;
32 }
33 double getspeed(double distance, double time)
34 {
35     return distance/time*3600;
36 }

 

POJ 1665

标签:

原文地址:http://www.cnblogs.com/gavinsp/p/4566489.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!