poj 1665 Biker's Trip Odometer

纯粹的水题

唯一需要注意的是time也是浮点型,还有g++不支持lf输出

 

#include <iostream>
#include<stdio.h>
using namespace std;
const int in=12;
const int feet=5280;
const double pi=3.1415927;

int main()
{
        int r;
        double d,time;
        scanf("%lf %d %lf",&d,&r,&time);
        if(r==0) return(0);
        double total=d*pi*r/in/feet;
        double v=total/time*3600;
        printf("Trip #%d: %.2f %.2f",1,total,v);

 


    int k=1;
    while(++k)
    {
        int r;
        double d,time;
        scanf("%lf %d %lf",&d,&r,&time);
        if(r==0) return(0);
        double total=d*pi*r/in/feet;
        double v=total/time*3600;
        printf("\nTrip #%d: %.2f %.2f",k,total,v);
    }
    return 0;
}

你可能感兴趣的:(poj 1665 Biker's Trip Odometer)