hoj2183 Extrusion

/*This Code is Submitted by billforum for Problem 2183 at 2012-02-20 15:36:33*/
#include <iostream>
#include <memory.h>
#include <stdlib.h>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;

int main()
{
 int n;
 double x0,y0,x1,y1,x2,y2;
 double ans,v;
   while(scanf("%d",&n)!=EOF)
   {
     if(n<3) break;
     ans=0;
     scanf("%lf%lf%lf%lf",&x0,&y0,&x1,&y1);
     for(int i=1;i<=n-2;i++)
     {
         scanf("%lf%lf",&x2,&y2);
         ans+=(x0*y1+x1*y2+x2*y0-y0*x1-y1*x2-y2*x0);
         x1=x2;
         y1=y2;
     }
     if(ans<0) ans=-ans;
     scanf("%lf",&v);
     printf("BAR LENGTH: %.2lf\n",2*v/ans);
   }
    return 0;
}


 

posted @ 2012-02-20 15:39  wuzhibin  阅读(186)  评论(0)    收藏  举报