Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <numeric>
- #include <vector>
- using namespace std;
- double Average(const vector<int>& xs) {
- if (xs.empty()) {
- return 0;
- }
- return accumulate(xs.begin(), xs.end(), 0.0) / xs.size();
- }
- int main() {
- // не меняйте код main
- cout << Average({1, 2, 2}) << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment