#852
Paranteze3
Se dau n
șiruri de paranteze rotunde sau pătrate. Să se stabilească, despre fiecare șir, dacă este corect parantezat.
Problema | Paranteze3 | Operații I/O |
paranteze3.in /paranteze3.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #48780652 | Utilizator | |
Fișier | paranteze3.cpp | Dimensiune | 607 B |
Data încărcării | 05 Februarie 2024, 14:18 | Scor / rezultat | Eroare de compilare |
paranteze3.cpp:8:12: error: conflicting declaration 'std::stack<char> st' stack<char>st; ^ paranteze3.cpp:6:5: error: 'st' has a previous declaration as 'int st [1001]' int st[1001]; ^ paranteze3.cpp: In function 'bool corect(char*)': paranteze3.cpp:10:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i=0; i<strlen(s); i++){ ^ paranteze3.cpp:12:19: error: request for member 'push' in 'st', which is of non-class type 'int [1001]' st.push(s[i]); ^ paranteze3.cpp:14:20: error: 'isempty' was not declared in this scope if(isempty()) return 0; ^ paranteze3.cpp:15:24: error: request for member 'top' in 'st', which is of non-class type 'int [1001]' if(s[i]==')' && st.top()=='[' || s[i]==']' && st.top()=='(') ^ paranteze3.cpp:15:54: error: request for member 'top' in 'st', which is of non-class type 'int [1001]' if(s[i]==')' && st.top()=='[' || s[i]==']' && st.top()=='(') ^ paranteze3.cpp:17:12: error: request for member 'pop' in 'st', which is of non-class type 'int [1001]' st.pop(); ^ paranteze3.cpp:19:15: error: request for member 'empty' in 'st', which is of non-class type 'int [1001]' return st.empty(); ^ paranteze3.cpp:22:1: error: a function-definition is not allowed here before '{' token { ^ paranteze3.cpp:29:1: error: expected '}' at end of input } ^ paranteze3.cpp:29:1: warning: control reaches end of non-void function [-Wreturn-type] } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Paranteze3 face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:
Suma punctajelor acordate pe testele utilizate pentru verificare este 100. Astfel, soluția ta poate obține cel mult 100 de puncte, caz în care se poate considera corectă.