Какую наиболее короткую формулу нужно записать в ячейку А1, чтобы вычислить среднее арифметическое значение выделенного диапазона( если бы в выделенных ячейках были записаны числа?)
1)var a:array [0..5] of Integer; i,j:Integer; begin Randomize; j:=0; for i:=0 to 5 do a[i]:=Random(100); for i:=0 to 5 do if a[i] mod 3 =0 then Inc(j); Writeln(j); readln; 2)var a:array [0..5] of Integer; i,j:Integer; begin Randomize; j:=0; for i:=0 to 5 do a[i]:=Random(100); for i:=0 to 5 do if a[i] mod 2 =0 then j:=j+a[i]; Writeln(j); readln; 3)a:array [0..5] of Integer; i,s:Integer; begin Randomize; s:=1; for i:=0 to 5 do a[i]:=Random(9)+1; for i:=0 to 5 do if i mod 2 <>0 then s:=s*a[i]; Writeln(s); readln; end. 4)const n=5;m=5; var a:array [0..n,0..m] of Integer; i,j:Integer; begin Randomize; for i:=0 to n do for j:=0 to m do a[i,j]:=Random(100); for i:=0 to n do begin Writeln; for j:=0 to m do write(a[i,j]:3); end; for i:=0 to n do for j:=0 to m do begin if a[i,j] mod 2 =0 then a[i,j]:=2 else if a[i,j] mod 2 <>0 then a[i,j]:=1; end; Writeln; for i:=0 to n do begin Writeln; for j:=0 to m do write(a[i,j]:3); end; Readln; end. 5)const n=5;m=5; var a:array [0..n,0..m] of Integer; i,j:Integer; begin Randomize; for i:=0 to n do for j:=0 to m do a[i,j]:=Random(10); for i:=0 to n do begin Writeln; for j:=0 to m do write(a[i,j]:3); end; for i:=0 to n do for j:=0 to m do a[i,j]:=a[i,j]*2; Writeln; for i:=0 to n do begin Writeln; for j:=0 to m do write(a[i,j]:3); end; Readln; end.
#include <iostream>
typedef long long ll;
using namespace std;
bool ll_is_valid(ll t, ll N, ll x, ll y)
{
return t / x + (t - x) / y >= N;
}
ll f(ll N, ll x, ll y)
{
ll R = 1;
while (!ll_is_valid(R,N,x,y)) R *= 2;
ll L = R / 2;
while(R - L > 1)
{
ll M = (L + R) / 2;
if (!ll_is_valid(M,N,x,y)) {L = M;}
else {R = M;}
}
return R;
}
int main()
{
ll N,x,y;
cin >> N >> x >> y;
if(x > y) swap( x, y );
cout << f(N, x, y) << std::endl;
}
1)var a:array [0..5] of Integer; i,j:Integer;
begin
Randomize;
j:=0;
for i:=0 to 5 do
a[i]:=Random(100);
for i:=0 to 5 do
if a[i] mod 3 =0 then
Inc(j);
Writeln(j);
readln;
2)var a:array [0..5] of Integer; i,j:Integer;
begin
Randomize;
j:=0;
for i:=0 to 5 do
a[i]:=Random(100);
for i:=0 to 5 do
if a[i] mod 2 =0 then
j:=j+a[i];
Writeln(j);
readln;
3)a:array [0..5] of Integer; i,s:Integer;
begin
Randomize;
s:=1;
for i:=0 to 5 do
a[i]:=Random(9)+1;
for i:=0 to 5 do
if i mod 2 <>0 then
s:=s*a[i];
Writeln(s);
readln;
end.
4)const n=5;m=5;
var a:array [0..n,0..m] of Integer; i,j:Integer;
begin
Randomize;
for i:=0 to n do
for j:=0 to m do
a[i,j]:=Random(100);
for i:=0 to n do
begin
Writeln;
for j:=0 to m do
write(a[i,j]:3);
end;
for i:=0 to n do
for j:=0 to m do
begin
if a[i,j] mod 2 =0 then
a[i,j]:=2
else if a[i,j] mod 2 <>0 then
a[i,j]:=1;
end;
Writeln;
for i:=0 to n do
begin
Writeln;
for j:=0 to m do
write(a[i,j]:3);
end;
Readln;
end.
5)const n=5;m=5;
var a:array [0..n,0..m] of Integer; i,j:Integer;
begin
Randomize;
for i:=0 to n do
for j:=0 to m do
a[i,j]:=Random(10);
for i:=0 to n do
begin
Writeln;
for j:=0 to m do
write(a[i,j]:3);
end;
for i:=0 to n do
for j:=0 to m do
a[i,j]:=a[i,j]*2;
Writeln;
for i:=0 to n do
begin
Writeln;
for j:=0 to m do
write(a[i,j]:3);
end;
Readln;
end.