|
|
back to boardWrogn Answer #4 Posted by uzbat 10 Sep 2014 15:39 #include <iostream> #include <cstdio> using namespace std; int main(int argc, char **argv) { int n, t; double *gandolas, *res; double s; cin >> n >> t >> s; gandolas = new double[n]; res = new double[n]; for(int i=0; i<n; i++)cin >> gandolas[i];
for(int i=0; i<n; i++){ if(i==0) if(gandolas[i] >= s){ res[i] = s + (t-(gandolas[i] - s))/2; s = res[i]; } else{ res[i] = s + (t-(s - gandolas[i]))/2; s = res[i]; } else{ res[i] = s + (gandolas[i] - gandolas[i-1])/2; s = res[i]; } } for(int i=0; i<n; i++)printf("%.6lf\n", res[i]); return 0; } can't imagine a test that make it crash |
|
|