UVA 12230(p333)----Crossing Rivers

#include<cstdio>
#include<iostream>
using namespace std;
int n,d;
double l[100],p[100],v[100];
int main()
{
    int k=0;
    while(scanf("%d%d",&n,&d)==2&&(n||d))
    {
        double temp1=0,temp2=0;
        k++;
        for(int i=0;i<n;i++)
        {
            scanf("%lf%lf%lf",&p[i],&l[i],&v[i]);
            temp1+=2*l[i]/v[i];
            temp2+=l[i];
        }
       printf("Case %d: %.3lf\n\n",k,temp1+d-temp2);

    }
   return 0;
}

你可能感兴趣的:(UVA 12230(p333)----Crossing Rivers)