Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <math.h>
- using namespace std;
- int main()
- {
- ofstream ofs("output.txt");
- ifstream ifs("input.txt");
- int c, g;
- ifs >> c;
- int *count = new int[c];
- for (int i = 0; i < c; i++)
- ifs >> count[i];
- float res = 0;
- for (int i = 0; i < c; i++)
- {
- res = 0; g = 0;
- for (int h = 0; h < count[i]; h++)
- {
- ifs >> g;
- res += g;
- }
- ofs << round(res / count[i]) << " ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement