Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- srand(time(0));
- int n = 20;
- vector<int> a1(n), a2(n), a3(n); // №1
- vector<int> b1, b2; // №2
- for (int i = 0; i < n; i++) {
- // cin >> a1[i];
- a1[i] = rand() % (99 - 10 + 1) + 10; // [10; 99]
- cout << a1[i] << " ";
- }
- cout << "\n";
- for (int i = 0; i < n; i++) {
- int x = a1[i], k = 0, s = 0;
- for (int d = 2; d * d <= x; d++) {
- if (x % d == 0) {
- k++;
- s += d;
- if (x / d != d) {
- k++;
- s += x / d;
- }
- }
- }
- if (s % 2 == 1) {
- b1.push_back(a1[i]);
- } else {
- b2.push_back(a1[i]);
- }
- a2[i] = s;
- a3[i] = k;
- }
- for (int i = 0; i < n; i++) {
- cout << a2[i] << " ";
- }
- cout << "\n";
- for (int i = 0; i < n; i++) {
- cout << a3[i] << " ";
- }
- cout << "\n\n\n";
- for (int i = 0; i < b1.size(); i++) {
- cout << b1[i] << " ";
- }
- cout << "\n";
- for (int i = 0; i < b2.size(); i++) {
- cout << b2[i] << " ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement