#include <iostream> int main() { int n; std::cin >> n; if (n < 1) { return 0; } // Write your dynamic buffer allocation code here int *buf = new int[n]; int avg = 0; for (int i = 0; i < n; i++) { std::cin >> buf[i]; avg += buf[i]; } std::cout << avg / n; delete [] buf; return 0; }
Test Cases
Test Results
Input
5 10 20 30 40 50
Expected Output
30