#define _CRT_SECURE_NO_WARNINGS #define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #define REP(i,a,b) for(i=a;i> n >> L; x[0] = 0; for(i=0;i+1> x[i+1]; if((L-abs(x[i+1]-x[i])) * 100 < 100) { rep = -1; goto end; } } for(i=n-2;i>-1;i--) { sum += x[i+1]; if(i+1 == n-2) ; else if(L <= fabs(x[i+1]-(double)sum/(n-2-i)) * 2 || L <= fabs(x[i]-(double)sum/(n-2-i) )*2) rep++; } end: printf("%d\n",rep); return 0; }