Răspuns :
1
#include
using namespace std;
int main() {
int n, m, v[51][51], k;
cin >> n >> m >> k;
for (int i = 1; i <= m; i++)
for (int j = 1; j <= n; j++) {
cin >> v[i][j];
v[i][j] += k;
}
for (int i = 1; i <= m; i++) {
for (int j = 1; j <= n; j++)
cout << v[i][j] << ' ';
cout << endl;
}
return 0;
}
2
#include
using namespace std;
int main() {
int n, m, a[51][51], b[51][51], c[51][51];
cin >> n >> m;
for (int i = 1; i <= m; i++)
for (int j = 1; j <= n; j++)
cin >> a[i][j];
for (int i = 1; i <= m; i++)
for (int j = 1; j <= n; j++)
cin >> b[i][j];
for (int i = 1; i <= m; i++)
for (int j = 1; j <= n; j++)
c[i][j] = a[i][j] + b[i][j];
for (int i = 1; i <= m; i++) {
for (int j = 1; j <= n; j++)
cout << c[i][j] << ' ';
cout << endl;
}
return 0;
}
3
#include<iostream>
using namespace std;
int main() {
int n, m, a[51][51];
cin >> n >> m;
for (int i = 1; i <= m; i++)
for (int j = 1; j <= n; j++)
cin >> a[i][j];
for (int j = 1; j <= n; j++) {
for (int i = 1; i <= m; i++)
cout << a[i][j] << ' ';
cout << endl;
}
return 0;
}
4
#include<iostream>
#include<cmath>
using namespace std;
int main() {
int n, m, k = 0;
float a[51][51], s = 0, p = 1;
cin >> n >> m;
for (int i = 1; i <= m; i++)
for (int j = 1; j <= n; j++) {
cin >> a[i][j];
s += a[i][j];
p *= a[i][j];
if (a[i][j] == floor(a[i][j])
k++;
}
cout << s << ' ' << p << ' ' << k;
return 0;
}
5
#include<iostream>
using namespace std;
int main() {
int n, m, a[51][51], max = -1;
cin >> n >> m;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++) {
cin >> a[i][j];
if (a[i][j] > max)
max = a[i][j];
}
cout << max << endl;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
if (a[i][j] == max)
cout << i << ' ' << j << ", ";
return 0;
}