blob: 466285a8ab7b8f798a23bc4ac0ef90aaefdd1f04 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#include <iostream>
#include <vector>
/*
*
* 3.24
*
*
*/
using std::string;
using std::cout;
using std::cin;
using std::cerr;
using std::clog;
using std::endl;
using std::vector;
int main () {
vector<int> VecNumbers;
int Numbers = 0;
while(cin >> Numbers) {
VecNumbers.push_back(Numbers);
}
for(auto Iterate = VecNumbers.cbegin() ; Iterate < VecNumbers.cend() ; Iterate += 2) {
auto First = Iterate;
auto Second = Iterate + 1;
cout << *First + *Second << " ";
}
cout << endl;
auto vnend = VecNumbers.cend()-1;
auto vnbeg = VecNumbers.cbegin();
while(vnbeg <= vnend) {
if (vnbeg == vnend) {
cout << *vnbeg + *vnend << " ";
break;
}
cout << *vnbeg + *vnend << " ";
--vnend;
++vnbeg;
}
cout << endl;
return 0;
}
|