ამ გვერდზე თქვენ იხილავთ გაგზავნილი ამოხსნების სტატუსს.
გაგზავნის თარიღი: 22.01.2023 12:32:47
ამოცანა: ფრჩხილთა კორექტული მიმდევრობა
მომხმარებელი: Leogvala
ვერდიქტი: ამოუხსნელი
შეფასება: 0 ქულა
#include <bits/stdc++.h> using namespace std; int a,b,c,d,i; string s; stack <char> st; int main(){ cin>>s; for(i=0; i<s.size();i++){ if(st.empty()) {st.push(s[i]); continue;} if(s[i]=='{' or s[i]=='(' or s[i]=='[') st.push(s[i]); if((s[i]=='}' and st.top=='{') or (s[i]==']' and st.top=='[')) st.pop(); if(s[i]==')' and st.top=='(') st.pop; } if(st.empty()) cout<<"YES"; else cout<<"NO"; }
main.cpp: In function 'int main()': main.cpp:11:29: error: invalid operands of types '<unresolved overloaded function type>' and 'char' to binary 'operator==' if((s[i]=='}' and st.top=='{') or (s[i]==']' and st.top=='[')) st.pop(); ~~~~~~^~~~~ main.cpp:11:60: error: invalid operands of types '<unresolved overloaded function type>' and 'char' to binary 'operator==' if((s[i]=='}' and st.top=='{') or (s[i]==']' and st.top=='[')) st.pop(); ~~~~~~^~~~~ main.cpp:12:28: error: invalid operands of types '<unresolved overloaded function type>' and 'char' to binary 'operator==' if(s[i]==')' and st.top=='(') st.pop; ~~~~~~^~~~~ main.cpp:12:38: error: invalid use of non-static member function 'void std::stack<_Tp, _Sequence>::pop() [with _Tp = char; _Sequence = std::deque<char, std::allocator<char> >]' if(s[i]==')' and st.top=='(') st.pop; ~~~^~~ In file included from /usr/include/c++/6/stack:61:0, from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:89, from main.cpp:1: /usr/include/c++/6/bits/stl_stack.h:244:7: note: declared here pop() ^~~