Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <sstream>
- #include <string>
- #include <memory>
- using namespace std;
- int main() {
- string line;
- getline(cin, line);
- istringstream ss(line);
- unique_ptr<int[]> numbers = make_unique<int[]>(1000);
- int n, counter = 0;
- while (ss >> n) {
- numbers[counter++] = n;
- }
- for (int i = 0; i < counter / 2; i++) {
- cout << numbers[i] + numbers[counter - (1 + i)] << ' ';
- }
- if (counter % 2 == 1) {
- cout << numbers[counter / 2];
- }
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement