#include <iostream>
#include <cstdlib>
#include <ctime>
#include <vector>
using namespace std;
int main() {
vector<int> arr;
int n;
cout << "n: ";
cin >> n;
srand(time(0));
long long sum = 0;
vector<long int> multi;
for(int i = 0; i<10; ++i) { // тут поменять чтобы изменить колво чисел
arr.push_back(rand());
if(i%2!=0) {
sum+=arr[arr.size()-1];
cout << arr[i] << " ";
multi.push_back(arr[arr.size()-1]*n);
}
cout << endl << "Multi: ";
for(int i = 0; i<multi.size(); ++i) {
cout << multi[i] << " ";
#include <algorithm>
bool myfunction (int i,int j) { return (i>j); }
int oneortwo() {
if(rand()%2==1) {
return 1;
} else {
return -1;
vector<long long int> arr;
setlocale(LC_ALL, "Russian");
for(int i = 0; i<5; ++i) {
arr.push_back(rand()*oneortwo());
cout << arr[arr.size()-1] << " ";
for(int i = 0; i<arr.size(); ++i) {
if(arr[i]>=0) {
sum+=arr[i];
arr[i]*=sum;
sort(arr.begin(), arr.end(), myfunction);
arr.erase(arr.begin()+arr.size()-1);
cout << endl << endl;
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <vector>
using namespace std;
int main() {
vector<int> arr;
int n;
cout << "n: ";
cin >> n;
srand(time(0));
long long sum = 0;
vector<long int> multi;
for(int i = 0; i<10; ++i) { // тут поменять чтобы изменить колво чисел
arr.push_back(rand());
if(i%2!=0) {
sum+=arr[arr.size()-1];
cout << arr[i] << " ";
multi.push_back(arr[arr.size()-1]*n);
}
}
cout << endl << "Multi: ";
for(int i = 0; i<multi.size(); ++i) {
cout << multi[i] << " ";
}
}
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
using namespace std;
bool myfunction (int i,int j) { return (i>j); }
int oneortwo() {
if(rand()%2==1) {
return 1;
} else {
return -1;
}
}
int main() {
vector<long long int> arr;
srand(time(0));
setlocale(LC_ALL, "Russian");
for(int i = 0; i<5; ++i) {
arr.push_back(rand()*oneortwo());
cout << arr[arr.size()-1] << " ";
}
long long sum = 0;
for(int i = 0; i<arr.size(); ++i) {
if(arr[i]>=0) {
sum+=arr[i];
}
}
for(int i = 0; i<arr.size(); ++i) {
arr[i]*=sum;
}
sort(arr.begin(), arr.end(), myfunction);
arr.erase(arr.begin()+arr.size()-1);
cout << endl << endl;
for(int i = 0; i<arr.size(); ++i) {
cout << arr[i] << " ";
}
}