#include <iostream>
#include <time.h>
#include <iomanip>
using namespace std;
int main()
{
int i, j, n, m;
double** a;
double p;
setlocale(LC_ALL, "Russian");
cout << "\nN = ";
cin >> n;
cout << "\nM = ";
cin >> m;
a = new double*[n];
for (i = 0; i < n; i++)
a[i] = new double[m];
srand(time(NULL));
for (i = 0; i < n; i++) {
for (j = 0; j < m; j++) {
a[i][j] = (double)rand() / (RAND_MAX + 1) * 10;
cout << setw (5) << fixed << setprecision (2) << a[i][j] << " ";
}
cout << "\n";
cout << "\nПроизведения строк:";
p = 1;
p *= a[i][j];
cout << setw (15) << fixed << setprecision(2) << right << "\n" << p;
#include <QCoreApplication>
#include <bits/stdc++.h>
#include <stdio.h>
int main(int argc, char *argv[])
QCoreApplication ap(argc, argv);
FILE *fp, *fout;
long long a, b, c, m;
fp = fopen ("0","r+");
fscanf (fp, "%lld\n%lld\n%lld", &a, &b, &c);
fclose(fp);
long long sum = 2 * a + 3 * b + 4 * c;
long long cnt = a + b + c;
long long l = 0, r = cnt + 1;
// Алгоритм бинарного поиска
while (l < r)
m = (l + r) / 2;
if ((sum + 5.0 * m) / (cnt + m) < 3.5)
l = m + 1;
else
r = m;
fout = fopen ("0.a","w+");
fprintf (fout,"%lld",l);
fclose(fout);
return
Объяснение:
#include <iostream>
#include <time.h>
#include <iomanip>
using namespace std;
int main()
{
int i, j, n, m;
double** a;
double p;
setlocale(LC_ALL, "Russian");
cout << "\nN = ";
cin >> n;
cout << "\nM = ";
cin >> m;
a = new double*[n];
for (i = 0; i < n; i++)
a[i] = new double[m];
srand(time(NULL));
for (i = 0; i < n; i++) {
for (j = 0; j < m; j++) {
a[i][j] = (double)rand() / (RAND_MAX + 1) * 10;
cout << setw (5) << fixed << setprecision (2) << a[i][j] << " ";
}
cout << "\n";
}
cout << "\nПроизведения строк:";
for (i = 0; i < n; i++) {
p = 1;
for (j = 0; j < m; j++) {
p *= a[i][j];
}
cout << setw (15) << fixed << setprecision(2) << right << "\n" << p;
}
cout << "\n";
}
#include <QCoreApplication>
#include <bits/stdc++.h>
#include <iostream>
#include <stdio.h>
using namespace std;
int main(int argc, char *argv[])
{
QCoreApplication ap(argc, argv);
FILE *fp, *fout;
long long a, b, c, m;
fp = fopen ("0","r+");
fscanf (fp, "%lld\n%lld\n%lld", &a, &b, &c);
fclose(fp);
long long sum = 2 * a + 3 * b + 4 * c;
long long cnt = a + b + c;
long long l = 0, r = cnt + 1;
// Алгоритм бинарного поиска
while (l < r)
{
m = (l + r) / 2;
if ((sum + 5.0 * m) / (cnt + m) < 3.5)
l = m + 1;
else
r = m;
}
fout = fopen ("0.a","w+");
fprintf (fout,"%lld",l);
fclose(fout);
return
Объяснение: