DMOPC '14 Contest 1 P3 - New Students
Source Code
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, s;
cin >> n;
int t;
double avg = 0;
int c = 0;
for(int i = 0; i < n; i++){
cin >> t;
avg += t;
}
cin >> s;
c = n;
for(int i = 0; i < s; i++){
cin >> t;
c++;
avg += t;
cout << setprecision(5) << (avg / c);
if( fmod(avg / c, 1) == 0){
cout << ".000";
}
cout << "\n";
}
return 0;
}