<span>Var
Text, Slovo, max:string;
Begin
WriteLn('Введите строку, разделенную пробелами: '); ReadLn(Tex);
Text:= Text + ' ';
max:='';
While Pos(' ',Text) <> 0 do
Begin
</span>Slovo<span>:= Copy(Text, 1, Pos(' ',Text) - 1);
Delete(Text, 1, Pos(' ',Text));
if Length(</span><span>Slovo</span><span>) > Length(max)
then max:= </span>Slovo<span>;
End;
WriteLn('Самое длинное слово: " ',max,' " его длина ',Length(max));
ReadLn;
End.</span>
Ответ: Александр может собрать 6 флажков
Program Pr1;
uses crt;
const n=100;
m=100;
var mas:array[1..n,1..m] of integer;
i,j,l,k,v:integer;
Begin
clrscr;
for j:=1 to m do
for i:=1 to n do begin
randomize;
mas[i,j]:=random(100);
end;
l:=0;v:=0;
for j:=1 to m do
for i:=1 to n do begin
k:=1;
while k<=m do if k=m then k:=k+1
else begin
l:=mas[i,k]+l;
k:=k+1;
end;
if mas[i,j]>l then v:=v+1;
l:=0;
end;
writeln(v);
end.
Ответ:
#include <iostream>
#include <time.h>
#include <iomanip>
using namespace std;
int main()
{
int a[20];
int i, ibeg, iend, s;
setlocale(LC_ALL, "Russian");
srand(time(NULL));
for (i = 0; i < 20; i++) {
a[i] = (double)rand() / (RAND_MAX + 1) * 10;
cout << a[i] << " ";
}
ibeg = -1;
for (i = 0; i < 20; i++) {
if (a[i] == 0) {
ibeg = i;
break;
}
}
iend = -1;
for (i = 20; i > 0; i--) {
if (a[i] == 0) {
iend = i;
break;
}
}
if (ibeg != -1 && iend != -1) {
s = 0;
for (i = ibeg + 1; i < iend; i++)
s += a[i];
cout << "\nСумма = " << s << "\n";
}
else
cout << "\nНулевые элементы не найдены.\n";
}
1) 66
2) 25
3) 110
Наслаждайся решением так сказать