');
sound(zvuk); delay(del); nosound;
readln; close(g);
halt;
End;
Procedure DAl;
Begin
writeln;
textcolor(14);
writeln(' Этап пройден успешно.');
textcolor(15);
readln; clrscr;
End;
Procedure leksika;
Begin
writeln(' 3 этап- Лексический анализ...');
writeln('> Проверка на присутствие недопустимых комбинаций знаков');
{удаляем ВСЕ пробелы из строки}
for i:= 1 to dlina do if b[i]<>' ' then s1:=s1+b[i];
writeln(s1);
dlina1:=length(s1);
{проверяем присутствие ошибочных комбинаций символов }
for i:=1 to dlina do begin
IF (
{повторяющиеся знаки}
((s1[i]='+') and (s1[i+1]='+')) or
((s1[i]='-') and (s1[i+1]='-')) or
((s1[i]='=') and (s1[i+1]='=')) or
((s1[i]=';') and (s1[i+1]=';')) or
((s1[i]='[') and (s1[i+1]='[')) or
((s1[i]=']') and (s1[i+1]=']')) or
{комбинации разных знаков }
((s1[i]='[') and (s1[i+1]='=')) or
((s1[i]='=') and (s1[i+1]='[')) or
((s1[i]='[') and (s1[i+1]=';')) or
((s1[i]=';') and (s1[i+1]='[')) or
((s1[i]='[') and (s1[i+1]=':')) or
((s1[i]=':') and (s1[i+1]='[')) or
((s1[i]=']') and (s1[i+1]=':')) or
((s1[i]=':') and (s1[i+1]=']')) or
((s1[i]='[') and (s1[i+1]='.')) or
((s1[i]='.') and (s1[i+1]='[')) or
((s1[i]='+') and (s1[i+1]='[')) or
{}
((s1[i]=']') and (s1[i+1]='=')) or
((s1[i]='=') and (s1[i+1]=']')) or
((s1[i]=';') and (s1[i+1]=']')) or
((s1[i]=']') and (s1[i+1]='.')) or
((s1[i]='.') and (s1[i+1]=']')) or
((s1[i+1] in c) and (s1[i]='.') and (s1[i-1] in bukva)) or
((s1[i+1] in c) and (s1[i]='.') and (s1[i-1] in bukva2)) or
((s1[i+1] in c) and (s1[i]='.') and
(s1[i-1] in c) and ((s1[i-2]='+') or (s1[i-2]='-'))) or
((s1[i]=']') and (s1[i+1]='+')) or
((s1[i]='+') and (s1[i+1]=']')) or
((s1[i]=']') and (s1[i+1]='-')) or
((s1[i]='-') and (s1[i+1]=']')) or
{}
((s1[i]='=') and (s1[i+1]=';')) or
((s1[i]=';') and (s1[i+1]='=')) or
((s1[i]='+') and (s1[i+1]='=')) or
((s1[i]='=') and (s1[i+1]='+')) or
((s1[i]=';') and (s1[i+1]='+')) or
((s1[i]='+') and (s1[i+1]=';')) or
((s1[i]=';') and (s1[i+1]='-')) or
((s1[i]='-') and (s1[i+1]=';')) or
((s1[i]='-') and (s1[i+1]='+')) or
((s1[i]='+') and (s1[i+1]='-')) or
((s1[i]='-') and (s1[i+1]='=')) or
((s1[i]='=') and (s1[i+1]='.')) or
((s1[i]='.') and (s1[i+1]='=')) or
((s1[i]='+') and (s1[i+1]='.')) or
((s1[i]='-') and (s1[i+1]='.')) or
((s1[i]=';') and (s1[i+1]='.')) or
((s1[i]='.') and (s1[i+1]=';'))
)
OR {AND?}
{комбинация ::= ::X :X= X:= где X-любой символ}
(
((s1[i]=':') and (s1[i+1]=':') and (s1[i+2]<>'=')) or
((s1[i]=':') and (s1[i+1]<>':') and (s1[i+2]='=')) or
((s1[i]='.') and (s1[i+1]<>'.') and (s1[i+2]='.')) { .X. }
)
then Netl;
end; {for}
{комбинация цифра' 'цифра - не допустима}
for i :=1 to dlina do
if
(
(s1[i] in c) and {(not (s1[i+1] in c)) and (s1[i+2] in c)) and }
((s1[i+1]=' ') and (s1[i+2]<>' ')) or
((s1[i+1]<>' ') and (s1[i+2]=' '))
)
and (s1[i+1]<>'.')
then NETl;
DAl;
End;
Const
s=5;
Var
ar:array[1..s] of integer;
n,m,i:integer;
begin
writeln('N');
readln(n);
writeln('M');
readln(m);
writeln('Array:');
for i:=1 to s do
readln(ar[i]);
writeln('First array:');
for i:=1 to s do
begin
write(ar[i]:4);
if ar[i] div n<>0 then ar[i]:=ar[i]+m;
end;
writeln;
writeln('Final array:');
for i:=1 to s do
write(ar[i]:4);
end.
Пример ввода:
3
3
1
2
3
4
5
Пример вывода:
First array:
1 2 3 4 5
Final array:
1 2 6 7 8
//Блок-схема во вложении
class SearchPalin{
public static void main(String args[]){
String palinString = new java.util.Scanner(System.in).nextLine();
System.out.print("\nПалиндром(-ы):\n ");
for(int wordStart = 0, wordEnd = 0; wordEnd<palinString.length(); wordEnd++)
if(wordEnd+1==palinString.length() || palinString.charAt(wordEnd+1)==' '){
String wordBeginning = "", wordEnding = "";
for(int wordBe = wordStart;wordBe<wordEnd+1;wordBe++)wordBeginning+=palinString.charAt(wordBe);
for(int wordEn = wordEnd;wordStart-1<wordEn;wordEn--)wordEnding+=palinString.charAt(wordEn);
if(wordBeginning.equals(wordEnding)){
for(int palinWord = wordStart;palinWord<=wordEnd;palinWord++)System.out.print(palinString.charAt(palinWord));
System.out.print("\n ");
} wordStart = wordEnd+2;
}
}
}