#include #include #include #include using namespace std; struct Point { double x,y; Point(double _x=0,double _y=0):x(_x),y(_y) { } inline bool operator<(const Point &b) { return x0?1:-1); } inline bool SIT(const Point &a1,const Point &a2,const Point &b1,const Point &b2) { double c1=Cross(a2-a1,b1-a1),c2=Cross(a2-a1,b2-a1), c3=Cross(b2-b1,a1-b1),c4=Cross(b2-b1,a2-b1); return dcmp(c1)*dcmp(c2)<0&&dcmp(c3)*dcmp(c4)<0; } inline Point LIT(const Point &P,const Vector &v,const Point &Q,const Vector &w) { Vector u=P-Q; double t=Cross(w,u)/Cross(v,w); return P+v*t; } const int maxn=105; int n,kase; double x[maxn*3+maxn*maxn]; Point L[maxn][2][2]; int main() { #ifdef local freopen("pro.in","r",stdin); #endif while(scanf("%d",&n)==1&&n) { int c=0; double res=0; for(int i=0;i=r.y) r=tr; } } l.y=max(l.y,0.0); if(dcmp(l.y)||dcmp(r.y)) { res+=Length(r-l); #ifdef debug printf("i=%d res+=%.5lf l=(%.5lf,%.5lf) r=(%.5lf,%.5lf)\n" ,i,Length(r-l) ,l.x,l.y ,r.x,r.y); assert(dcmp(r.x-x[i])==0); assert(dcmp(r.y+1)); #endif } #ifdef debug printf("after i=%d res is %.5lf\n",i,res); printf("\n"); #endif l=r; } printf("Case %d: %.0lf\n\n",++kase,res); } return 0; } /* 1 100 50 100 3 20 30 35 37 24 29 60 20 13 0 */