#include <iostream>#include <cmath>using namespace std; int main() {int a,b,c,d,suma=0;cin>>a;for (int i=0;i<a;i++){cin>>b;for (int i=0;i<b;i++){cin>>c;suma+=c;}d=suma/b;cout<<d<<endl;} return 0;}
3 4 1 2 3 4 4 4 3 2 1 4 0 3 2 4
2 5 7
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!