#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n, m;
void func(int y[m]){
for(int i = 0; i < m; i++){
for(int j = i; j < m; j++){
if(y[i] > y[j]){
int tmp = y[i];
y[i] = y[j];
y[j] = tmp;
}
int main() {
cin >> n >> m;
int a[n][m];
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cin >> a[i][j];
int pr = 1;
if(i % 2 == 0){
pr = 1;
func(a[i]);
pr *= a[i][j];
else{
a[i][j] = pr;
cout << a[i][j] << " ";
cout << endl;
Задание 1
int a, b;
cin >> a >> b;
cout << a - b;
Задание 2
#include <math.h>
int a;
cin >> a;
cout << pow(a, 2) << ' ' << pow(a, 3)<< ' ' << pow(a, 5);
Задание 3
cout << "The next number for the number " << a << " is " << a + 1 <<"!\n" <<"The previous number for the number "<< a << " is " << a - 1 <<"!";
Задание 4
cout << (3 * pow(a, 3) + 18 * pow(a, 2)) * a + 12 * pow(a, 2) - 5;
Задание 5
int a, b, c;
cin >> a >> b >> c;
cout << a % 7 << "\n" << b % 7 << "\n" << c % 7;
Задание 6
int a, b, c, a1, b1, c1;
cin >> a >> a1 >> b >> b1 >> c >> c1;
cout << a1 % (8 - a) << "\n" << b1 % (8 - b) << "\n" << c1 % (8 - c);
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n, m;
void func(int y[m]){
for(int i = 0; i < m; i++){
for(int j = i; j < m; j++){
if(y[i] > y[j]){
int tmp = y[i];
y[i] = y[j];
y[j] = tmp;
}
}
}
}
int main() {
cin >> n >> m;
int a[n][m];
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cin >> a[i][j];
}
}
int pr = 1;
for(int i = 0; i < n; i++){
if(i % 2 == 0){
pr = 1;
func(a[i]);
for(int j = 0; j < m; j++){
pr *= a[i][j];
}
}
else{
for(int j = 0; j < m; j++){
a[i][j] = pr;
}
}
}
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
cout << a[i][j] << " ";
}
cout << endl;
}
}
Задание 1
#include <iostream>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
cout << a - b;
}
Задание 2
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int a;
cin >> a;
cout << pow(a, 2) << ' ' << pow(a, 3)<< ' ' << pow(a, 5);
}
Задание 3
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int a;
cin >> a;
cout << "The next number for the number " << a << " is " << a + 1 <<"!\n" <<"The previous number for the number "<< a << " is " << a - 1 <<"!";
}
Задание 4
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int a;
cin >> a;
cout << (3 * pow(a, 3) + 18 * pow(a, 2)) * a + 12 * pow(a, 2) - 5;
}
Задание 5
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout << a % 7 << "\n" << b % 7 << "\n" << c % 7;
}
Задание 6
#include <iostream>
#include <math.h>
using namespace std;
int main() {
int a, b, c, a1, b1, c1;
cin >> a >> a1 >> b >> b1 >> c >> c1;
cout << a1 % (8 - a) << "\n" << b1 % (8 - b) << "\n" << c1 % (8 - c);
}