Предмет: Информатика, автор: Virys1812

Даны натуральные числа m и n. Получить все натуральные числа, меньшие n, квадрат суммы цифр которых равен m.

Ответы

Автор ответа: alexmagic221
0
begin   s1:=copy(s,1,pos(' ',s)-1);{копируем первое слово до пробела}   for i:=pos(' ',s)+1 to length(s) do{смотрим строку дальше}   if (copy(s,i,length(s1))=s1){если набор символов совпадает с этим словом}      and(s[i-1]=' '){и перед ним пробел}      and((s[i+length(s1)]=' '){и за ним пробел}      or(i+length(s1)-1=length(s))) then{или это последнее слово}       begin        k:=1;{фиксируем совпадение}        s2:=s1;{запоминаем слово}        write('Одинаковые слова ',s2);{выводим на экран}        readln;        exit;{выходим из программы, нужно только 1 пару}       end;   delete(s,1,pos(' ',s));{удаляем первое слово, следующее первое}  end; if k=0 then write('Нет двух одинаковых слов'); readln end.
Похожие вопросы
Предмет: Биология, автор: Аноним
Предмет: Английский язык, автор: sonechko2525
Английский!!!!! Пожалуйста, срочноо

Fill in the verbs in brackets in the appropriate tense and voice forms.

A Muslim Wedding
Five hundred guests and four days of festivities 1______ (to mark) the marriage of Naila and Rizwan Minhas. Theirs 2_____ (to be) a winter wedding, last December: Naila veiled in the traditional Punjabi wedding outfit of beaded red lace, 3_______ (to remember) shivering in the snow as she 4_______ (to take) from one venue to the next. 'An Asian wedding is a really big deal and people 5_______ (to travel) miles to go to them - we 6______ (to have) 30 guests from Hong Kong, Pakistan and the United States at ours,' says Naila. Naila and Rizwan both 7_______ (to grow up) in Glasgow where their parents 8_______ (to be) friends for years. 'It 9______(not to be) exactly an arranged marriage,' says Rizwan, 'but you could say there was a fair amount of parental persuasion. We 10________ (to do) it if we 11_________(to be) both very happy with one another, though.'
The wedding celebrations 12_______ (to start) when 250 guests 13_______ (to gather) to welcome Naila and mark her hands with henna, the traditional greeting for a bride. The following evening there was a similar ceremony for Rizwan. The actual marriage took place at Eastwood Hall in Glasgow and the couple 14_________ (to arrive) separately to the serenade of a kilted piper. 'I feel very Scottish as well as Asian,' explains Rizwan. During the ceremony itself, the couple 15 ______ (to be) in different rooms - the priest 16______ (to go) first to the bridegroom and then to the bride to ask whether they 17________ (to consent) to the marriage. A ring ceremony 18_______ (to follow), in which Rizwan's mother placed a gold ring on Naila's finger and Naila's mother placed one on Rizwan's. 'Wearing rings is a western custom which we 19______ (to start) following too,' says Rizwan. A sit-down meal of traditional Pakistani dishes 20________ (to follow) by speeches. Naila, now officially part of Rizwan's family, left with him for his family home where music and dancing continued into the night. The newly-weds 21_______ (to stay) with Rizwan's parents for a few days before leaving for a honeymoon in Tunisia.