Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <numeric>
- int main()
- {
- using namespace std;
- int vector_size;
- cin >> vector_size;
- vector<int> v;
- for (int i = 0; i < vector_size; ++i)
- {
- int n;
- cin >> n;
- v.push_back(n);
- }
- int sum = accumulate(v.begin(), v.end(), 0);
- cout << sum << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment