program mas_kol_otr_kol_p;
const
n=10;
var
i,s:integer;
a:array[1..n] of integer;
begin
randomize;
writeln('Введите массив 》');
for i:=1 to n do
begin
a[i]:=random(61)-30;
write(a[i]:3,' ');
end;
writeln;
writeln('Меняем отрицательные на противоположные... 》');
for i:=1 to n do
begin
if(a[i]<0) then
a[i]:=abs(a[i]);
write(a[i]:3,' ');
end;
writeln;
writeln('Удаляем третий элемент... 》');
for i:=1 to n-1 do
begin
if(i>2) then
a[i]:=a[i+1];
write(a[i]:3,' ');
end;
writeln;
writeln('Считаем сумму... 》');
s:=0;
for i:=1 to n-1 do
s:=s+a[i];
write(s);
end.
#include <iostream>
#include<vector>
using namespace std;
int square(int x){
for (int i = 1; i <= 45; ++i){
if (i * i <= x){
continue;
}
return (i - 1) * (i - 1);
}
}
int main()
{
int x, y, xwas, ywas, xywas;
cin >> x >> y;
xwas = square(x);
ywas = square(y);
xywas = square(x + y);
if (xwas + ywas < xywas){
cout << "Petya gives paint to Vasya";
}
else if (xwas + ywas == xywas){
cout << "Equal";
}
else {
cout << "Petya leaves paint to himself";
}
return 0;
}#include <iostream>
#include<vector>
using namespace std;
int square(int x){
for (int i = 1; i <= 45; ++i){
if (i * i <= x){
continue;
}
return (i - 1) * (i - 1);
}
}
int main()
{
int x, y, xwas, ywas, xywas;
cin >> x >> y;
xwas = square(x);
ywas = square(y);
xywas = square(x + y);
if (xwas + ywas < xywas){
cout << "Petya gives paint to Vasya";
}
else if (xwas + ywas == xywas){
cout << "Equal";
}
else {
cout << "Petya leaves paint to himself";
}
return 0;
}
Объяснение:
S1 = Cells(3, 6)
S2 = Cells(4, 2)
b = Mid(S1, 1, 1)
L1 = Len(S1)
N = 0
L2 = Len(S2)
For i = 1 To L2
a = Mid(S2, i, 1)
If a = b Then
SS = Mid(S2, i, L1)
If SS = S1 Then
N = N + 1
End If
End If
Next i
Cells(3, 10) = N
End Sub