1 #include "bitsstdc++.h" 2 using namespace std; 3 int n, T; 4 double c; 5 int ans[200010]; 6 7 int m, p; 8 9 int main() 10 { 11 scanf("%d%d%lf", &n, &T, &c); 12 int i; 13 for(i = 1; i <= n; ++i) { 14 scanf("%d", &ans[i]); 15 } 16 scanf("%d", &m); 17 i = 1; 18 __int64 sum = 0; 19 double mean = 0; 20 int j; 21 for(j = 1; j <= m; ++j) { 22 scanf("%d", &p); 23 for( ; i <= p; ++i) { 24 sum += ans[i]; 25 if(i > T) 26 sum -= ans[i - T]; 27 mean = (mean + (double)ans[i] / T) / c; 28 } 29 double real = (double)sum / T; 30 printf("%f %f %f ", real, mean, (double)fabs(mean - real) / real); 31 } 32 }