Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя 1726

Автор 1726, история, 11 месяцев назад, По-английски

Given a string S1 of length L1 consisting of Latin uppercase alphabets only and a string S2 of length L2 consisting of characters 'T'and 'F' only. Generate a lexicographically smallest string S of length (L1 + L2 - 1) such that a substring of length L1 in string S starting at index i (0 ≤ i < L2) is equal to S1 if and only if ith element of 52 is 'T (without quotes) else not. If no such string can be generated, print "-1" (without quotes). Notes A string a is lexicographically smaller than a string b if and only if one of the following holds: • a is a prefix of b, but a ‡ b; • in the first position where a and b differ, the string a has a letter that appears earlier in the alphabet than the corresponding letter in b. Find the lexicographically smallest string S which satisfies the given condition. Function description

Полный текст и комментарии »

  • Проголосовать: нравится
  • +5
  • Проголосовать: не нравится