begin readln(str); //str := 'Day 10, mice 8: "Year" 7 is a mistake 91.'; foreach c: char in str do if (Char.IsDigit(c)) then num += c; for j: byte := 1 to length(num) - 2 do for i: byte := 1 to length(num) - 1 do if (num[i] < num[i + 1]) then begin str[1] := num[i]; num[i] := num[i + 1]; num[i + 1] := str[1]; end; if (Integer.Parse(num) > 0) then begin while (num[num.Length - 1] = '0') do num.Remove(num.Length - 1); writeln('Да' + #13 + num); end else writeln('Нет'); end.
begin readln(str); //str := 'Day 10, mice 8: "Year" 7 is a mistake 91.'; foreach c: char in str do if (Char.IsDigit(c)) then num += c; for j: byte := 1 to length(num) - 2 do for i: byte := 1 to length(num) - 1 do if (num[i] < num[i + 1]) then begin str[1] := num[i]; num[i] := num[i + 1]; num[i + 1] := str[1]; end; if (Integer.Parse(num) > 0) then begin while (num[num.Length - 1] = '0') do num.Remove(num.Length - 1); writeln('Да' + #13 + num); end else writeln('Нет'); end.
1)
1v1&0=1
1v0&0=1
2)
0&0&1=0
0&1&1=0
1&0&1=0
1&1&1=1