Объяснение:
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int N;
cin >> N;
vector<int>chet;
vector<int>nechet;
for (int i = 0; i < N; i++) {
int A;
cin >> A;
if (i % 2 == 0)
nechet.push_back(A);
else
chet.push_back(A);
}
for (int i = 0; i < chet.size(); i++)
cout << chet[i] << " ";
cout << endl;
for (int i = 0; i < nechet.size(); i++)
cout << nechet[i] << " ";
vector<int>negative;
vector<int>positive;
if (A < 0)
negative.push_back(A);
positive.push_back(A);
for (int i = 0; i < negative.size(); i++)
cout<< negative[i]<<" ";
for (int i = 0; i < positive.size(); i++)
cout << positive[i] << " ";
Объяснение:
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int N;
cin >> N;
vector<int>chet;
vector<int>nechet;
for (int i = 0; i < N; i++) {
int A;
cin >> A;
if (i % 2 == 0)
nechet.push_back(A);
else
chet.push_back(A);
}
for (int i = 0; i < chet.size(); i++)
cout << chet[i] << " ";
cout << endl;
for (int i = 0; i < nechet.size(); i++)
cout << nechet[i] << " ";
}
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int N;
cin >> N;
vector<int>negative;
vector<int>positive;
for (int i = 0; i < N; i++) {
int A;
cin >> A;
if (A < 0)
negative.push_back(A);
else
positive.push_back(A);
}
for (int i = 0; i < negative.size(); i++)
cout<< negative[i]<<" ";
for (int i = 0; i < positive.size(); i++)
cout << positive[i] << " ";
}