Загрузка...

Решите задачу на языке с++ только

Тема в разделе C/C++ создана пользователем YaSosuBibu_inactive3639457 4 ноя 2020. 189 просмотров

  1. YaSosuBibu_inactive3639457
    YaSosuBibu_inactive3639457 Автор темы 4 ноя 2020 Заблокирован(а) 0 3 ноя 2020
    Given a sequence of N round, square and curly brackets. Find out whether you can add the numbers and arithmetic operations so you could obtain a correct arithmetic expression.

    Input
    The first line contains the number of brackets - N (1 ≤ N ≤ 100 000).
    The second contains the sequence of N symbols from the set (,) [,] {,}.
    Output
    Displays the word "Yes", if you can get a correct arithmetic expression, or "No", if you can not.

    Note: Use struct,pointer,dynamic memory;

    Sample 1

    Input;

    6
    ([())]

    Output;

    No

    Sample 2;


    Input;

    24
    {[()([]{})[]]({}{{}})}[]

    Output;

    Yes
     
Загрузка...
Top