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

Автор In_The_Name_Of_Love, история, 6 лет назад, По-английски

You're given String which consists of open and close bracket, numbers and question mark (?). Also you're given two integer M and N. M is number of plus (+) and N is number of minus (-). You'll have to replace question mark (?) with plus (+) or minus (-) and maximize the expression. You'll have to use exactly M plus (+) and N (-). It is guaranteed that M + N = Number of question mark(?).

1 <= Length of String <= 10000

Example : String : ((1?(5?7))?((6?2)?7)) M = 3, N = 2

if we put 3 plus (+) and 2 minus (-) then, ((1-(5-7))+((6+2)+7)) Answer : 18

How to tackle this Problem?

Thank you!

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

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