SHARE
TWEET

408 help

a guest Dec 11th, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #я плюсики переделаю в пробелы, просто для наглядности так удобнее. ниработаит :С
  2. k,n = map(int,input().split())
  3.  
  4. ans = []
  5. i = 0
  6. impossible = False
  7.  
  8. for i in range(n):
  9.     s = input()
  10.     while s[i] == '+':
  11.         i += 1
  12.     j = len(s) - 1
  13.     while s[j] != '+':
  14.         j -= 1
  15.     s = s[i:j]
  16.     if len(s) > k:
  17.         impossible = True
  18.         break
  19.     else:
  20.         k -= len(s)
  21.         ans.append('+' * (k//2) + s + '+' * (k//2 + k%2))
  22.  
  23.  
  24. print(*ans, sep = '\n')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top