Вводится очень длинное число. Выведите процесс его укорачивания справа и слева по одной цифре за раз, каждый результат с новой строки. Пример: Ввод Вывод 123456789 123456789 2345678 34567 456 5
// PascalABC.NET 3.0,сборка 1073 const n=10; var a,b:array[1..n] of integer; i,p,k,max:integer; begin Randomize; max:=-200; k:=0; Writeln(' № A B AixBi'); Writeln(''); for i:=1 to n do begin a[i]:=Random(21)-10; b[i]:=Random(21)-10; p:=a[i]*b[i]; Writeln(i:2,a[i]:4,b[i]:4,p:5); if p<0 then begin Inc(k); if p>max then max:=p end end; Writeln(''); Writeln('Количество AixBi<0 равно ',k); Writeln('Максимум среди этих произведений равен ',max); end.
|
/a,b,c/
| - +
< a>b and a>c > - /a/
| - + |
< b>c > /b/
| - |
/c/(konec)
(начало)
|
/a,b,c,d,e/
| - +
< a>b and a>c and a>d and a>e> - /a/
| - + |
< b>c and b>d and b>e > /b/
| - + |
< b>d and b>e > - /c/
| - + |
< d>e > /d/
| - |
/d/(konec)
(nachalo)
|
/a,b,c/
| +
< a=b and b=c >/'Wse starshe wseh'/
| - + + |
< a=b >< a > c >/'A u B starshe C'/
| | - |
| +/'C starshe wseh'/
| - + + |
< b=c >< b > a >/'B u C starshe A'/
| | - |
| +/'A starshe wseh'/
| - + + |
< a=c >< a > b >/'A u C starshe B'/
| | - |
| +/'B starshe wseh'/
| - + |
< a>b and a>c > /'A starshe wseh'/
| - + |
< b>c > /'B starshe wseh'/
| - |
/'C starshe wseh'/(konec)