#4242
perle
Graniţa nu se trece uşor. Asta pentru că Balaurul Arhirel (mare pasionat de informatică) nu lasă pe nimeni să treacă decât după ce răspunde la nişte întrebări. În acea ţară există trei tipuri de perle normale (le vom nota cu 1
, 2
şi 3
) şi trei tipuri de perle magice (le vom nota cu A
, B
şi C
). Perlele magice sunt deosebite prin faptul că se pot transforma în alte perle (una sau mai multe, normale sau magice). Să se determine pentru fiecare şir de intrare dacă se poate obţine prin transformările de mai sus sau nu (alegând orice primă perlă magică, la fiecare şir).
Problema | perle | Operații I/O |
perle.in /perle.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #53507869 | Utilizator | |
Fișier | perle.cpp | Dimensiune | 968 B |
Data încărcării | 03 Noiembrie 2024, 17:13 | Scor / rezultat | Eroare de compilare |
perle.cpp:7:1: error: stray '\342' in program ifstream fin(“perle.in”); ^ perle.cpp:7:1: error: stray '\200' in program perle.cpp:7:1: error: stray '\234' in program perle.cpp:7:1: error: stray '\342' in program perle.cpp:7:1: error: stray '\200' in program perle.cpp:7:1: error: stray '\235' in program perle.cpp:8:1: error: stray '\342' in program ofstream fout (“perle.out”); ^ perle.cpp:8:1: error: stray '\200' in program perle.cpp:8:1: error: stray '\234' in program perle.cpp:8:1: error: stray '\342' in program perle.cpp:8:1: error: stray '\200' in program perle.cpp:8:1: error: stray '\235' in program perle.cpp:15:1: error: stray '\342' in program while( p <= n ) { if( stk.empty()) return false; l = stk.top(); stk.pop(); if( l 'B') { if( v[p] 2) { stk.push(‘B’); p++; continue; } if( p + 4 <= n && v[p] 1 && v[p + 2] 3) { stk.push(‘C’); p = p + 4; continue; } if( v[p] 3 ) return false; } if( l ‘C’) {//C -> 2 | 3BC | 12A if( v[p] 2 ) { p++; continue; } if( v[p] 3 ) { stk.push(‘C’); stk.push(‘B’); p++; continue; } if(p + 2 <= n && v[p] 1 && v[p + 1] 2 ) { p = p + 3; continue; } } } return stk.empty(); } int main() { int m; fin >> m; for(int i = 1; i <= m; i++) { fin >> n; v = vector<int>( n + 1); for(int j = 1; j <= n; j++) fin >> v[j]; if( Perla(‘B’) true || Perla ('C') true || n == 1) fout << “1\n”; else fout << “0\n”; } ^ perle.cpp:15:1: error: stray '\200' in program perle.cpp:15:1: error: stray '\230' in program perle.cpp:15:1: error: stray '\342' in program perle.cpp:15:1: error: stray '\200' in program perle.cpp:15:1: error: stray '\231' in program perle.cpp:15:1: error: stray '\342' in program perle.cpp:15:1: error: stray '\200' in program perle.cpp:15:1: error: stray '\230' in program perle.cpp:15:1: error: stray '\342' in program perle.cpp:15:1: error: stray '\200' in program perle.cpp:15:1: error: stray '\231' in program perle.cpp:15:1: error: stray '\342' in program perle.cpp:15:1: error: stray '\200' in program perle.cpp:15:1: error: stray '\230' in program perle.cpp:15:1: error: stray '\342' in program perle.cpp:15:1: error: stray '\200' in program perle.cpp:15:1: error: stray '\231' in program perle.cpp:7:17: error: 'perle' was not declared in this scope ifstream fin(“perle.in”); ^ perle.cpp:8:19: error: 'perle' was not declared in this scope ofstream fout (“perle.out”); ^ perle.cpp: In function 'bool Perla(char)': perle.cpp:15:82: error: expected ')' before 'B' while( p <= n ) { if( stk.empty()) return false; l = stk.top(); stk.pop(); if( l 'B') { if( v[p] 2) { stk.push(‘B’); p++; continue; } if( p + 4 <= n && v[p] 1 && v[p + 2] 3) { stk.push(‘C’); p = p + 4; continue; } if( v[p] 3 ) return false; } if( l ‘C’) {//C -> 2 | 3BC | 12A if( v[p] 2 ) { p++; continue; } if( v[p] 3 ) { stk.push(‘C’); stk.push(‘B’); p++; continue; } if(p + 2 <= n && v[p] 1 && v[p + 1] 2 ) { p = p + 3; continue; } } } return stk.empty(); } int main() { int m; fin >> m; for(int i = 1; i <= m; i++) { fin >> n; v = vector<int>( n + 1); for(int j = 1; j <= n; j++) fin >> v[j]; if( Perla(‘B’) true || Perla ('C') true || n == 1) fout << “1\n”; else fout << “0\n”; } ^ perle.cpp:15:98: error: expected ')' before numeric constant while( p <= n ) { if( stk.empty()) return false; l = stk.top(); stk.pop(); if( l 'B') { if( v[p] 2) { stk.push(‘B’); p++; continue; } if( p + 4 <= n && v[p] 1 && v[p + 2] 3) { stk.push(‘C’); p = p + 4; continue; } if( v[p] 3 ) return false; } if( l ‘C’) {//C -> 2 | 3BC | 12A if( v[p] 2 ) { p++; continue; } if( v[p] 3 ) { stk.push(‘C’); stk.push(‘B’); p++; continue; } if(p + 2 <= n && v[p] 1 && v[p + 1] 2 ) { p = p + 3; continue; } } } return stk.empty(); } int main() { int m; fin >> m; for(int i = 1; i <= m; i++) { fin >> n; v = vector<int>( n + 1); for(int j = 1; j <= n; j++) fin >> v[j]; if( Perla(‘B’) true || Perla ('C') true || n == 1) fout << “1\n”; else fout << “0\n”; } ^ perle.cpp:15:115: error: 'B' was not declared in this scope while( p <= n ) { if( stk.empty()) return false; l = stk.top(); stk.pop(); if( l 'B') { if( v[p] 2) { stk.push(‘B’); p++; continue; } if( p + 4 <= n && v[p] 1 && v[p + 2] 3) { stk.push(‘C’); p = p + 4; continue; } if( v[p] 3 ) return false; } if( l ‘C’) {//C -> 2 | 3BC | 12A if( v[p] 2 ) { p++; continue; } if( v[p] 3 ) { stk.push(‘C’); stk.push(‘B’); p++; continue; } if(p + 2 <= n && v[p] 1 && v[p + 1] 2 ) { p = p + 3; continue; } } } return stk.empty(); } int main() { int m; fin >> m; for(int i = 1; i <= m; i++) { fin >> n; v = vector<int>( n + 1); for(int j = 1; j <= n; j++) fin >> v[j]; if( Perla(‘B’) true || Perla ('C') true || n == 1) fout << “1\n”; else fout << “0\n”; } ^ perle.cpp:15:162: error: expected ')' before numeric constant while( p <= n ) { if( stk.empty()) return false; l = stk.top(); stk.pop(); if( l 'B') { if( v[p] 2) { stk.push(‘B’); p++; continue; } if( p + 4 <= n && v[p] 1 && v[p + 2] 3) { stk.push(‘C’); p = p + 4; continue; } if( v[p] 3 ) return false; } if( l ‘C’) {//C -> 2 | 3BC | 12A if( v[p] 2 ) { p++; continue; } if( v[p] 3 ) { stk.push(‘C’); stk.push(‘B’); p++; continue; } if(p + 2 <= n && v[p] 1 && v[p + 1] 2 ) { p = p + 3; continue; } } } return stk.empty(); } int main() { int m; fin >> m; for(int i = 1; i <= m; i++) { fin >> n; v = vector<int>( n + 1); for(int j = 1; j <= n; j++) fin >> v[j]; if( Perla(‘B’) true || Perla ('C') true || n == 1) fout << “1\n”; else fout << “0\n”; } ^ perle.cpp:15:193: error: 'C' was not declared in this scope while( p <= n ) { if( stk.empty()) return false; l = stk.top(); stk.pop(); if( l 'B') { if( v[p] 2) { stk.push(‘B’); p++; continue; } if( p + 4 <= n && v[p] 1 && v[p + 2] 3) { stk.push(‘C’); p = p + 4; continue; } if( v[p] 3 ) return false; } if( l ‘C’) {//C -> 2 | 3BC | 12A if( v[p] 2 ) { p++; continue; } if( v[p] 3 ) { stk.push(‘C’); stk.push(‘B’); p++; continue; } if(p + 2 <= n && v[p] 1 && v[p + 1] 2 ) { p = p + 3; continue; } } } return stk.empty(); } int main() { int m; fin >> m; for(int i = 1; i <= m; i++) { fin >> n; v = vector<int>( n + 1); for(int j = 1; j <= n; j++) fin >> v[j]; if( Perla(‘B’) true || Perla ('C') true || n == 1) fout << “1\n”; else fout << “0\n”; } ^ perle.cpp:15:232: error: expected ')' before numeric constant while( p <= n ) { if( stk.empty()) return false; l = stk.top(); stk.pop(); if( l 'B') { if( v[p] 2) { stk.push(‘B’); p++; continue; } if( p + 4 <= n && v[p] 1 && v[p + 2] 3) { stk.push(‘C’); p = p + 4; continue; } if( v[p] 3 ) return false; } if( l ‘C’) {//C -> 2 | 3BC | 12A if( v[p] 2 ) { p++; continue; } if( v[p] 3 ) { stk.push(‘C’); stk.push(‘B’); p++; continue; } if(p + 2 <= n && v[p] 1 && v[p + 1] 2 ) { p = p + 3; continue; } } } return stk.empty(); } int main() { int m; fin >> m; for(int i = 1; i <= m; i++) { fin >> n; v = vector<int>( n + 1); for(int j = 1; j <= n; j++) fin >> v[j]; if( Perla(‘B’) true || Perla ('C') true || n == 1) fout << “1\n”; else fout << “0\n”; } ^ perle.cpp:15:261: error: expected ')' before 'C' while( p <= n ) { if( stk.empty()) return false; l = stk.top(); stk.pop(); if( l 'B') { if( v[p] 2) { stk.push(‘B’); p++; continue; } if( p + 4 <= n && v[p] 1 && v[p + 2] 3) { stk.push(‘C’); p = p + 4; continue; } if( v[p] 3 ) return false; } if( l ‘C’) {//C -> 2 | 3BC | 12A if( v[p] 2 ) { p++; continue; } if( v[p] 3 ) { stk.push(‘C’); stk.push(‘B’); p++; continue; } if(p + 2 <= n && v[p] 1 && v[p + 1] 2 ) { p = p + 3; continue; } } } return stk.empty(); } int main() { int m; fin >> m; for(int i = 1; i <= m; i++) { fin >> n; v = vector<int>( n + 1); for(int j = 1; j <= n; j++) fin >> v[j]; if( Perla(‘B’) true || Perla ('C') true || n == 1) fout << “1\n”; else fout << “0\n”; } ^ perle.cpp:15:267: error: expected '}' at end of input while( p <= n ) { if( stk.empty()) return false; l = stk.top(); stk.pop(); if( l 'B') { if( v[p] 2) { stk.push(‘B’); p++; continue; } if( p + 4 <= n && v[p] 1 && v[p + 2] 3) { stk.push(‘C’); p = p + 4; continue; } if( v[p] 3 ) return false; } if( l ‘C’) {//C -> 2 | 3BC | 12A if( v[p] 2 ) { p++; continue; } if( v[p] 3 ) { stk.push(‘C’); stk.push(‘B’); p++; continue; } if(p + 2 <= n && v[p] 1 && v[p + 1] 2 ) { p = p + 3; continue; } } } return stk.empty(); } int main() { int m; fin >> m; for(int i = 1; i <= m; i++) { fin >> n; v = vector<int>( n + 1); for(int j = 1; j <= n; j++) fin >> v[j]; if( Perla(‘B’) true || Perla ('C') true || n == 1) fout << “1\n”; else fout << “0\n”; } ^ perle.cpp:15:267: error: expected '}' at end of input perle.cpp:15:267: error: expected '}' at end of input perle.cpp:15:267: warning: control reaches end of non-void function [-Wreturn-type] while( p <= n ) { if( stk.empty()) return false; l = stk.top(); stk.pop(); if( l 'B') { if( v[p] 2) { stk.push(‘B’); p++; continue; } if( p + 4 <= n && v[p] 1 && v[p + 2] 3) { stk.push(‘C’); p = p + 4; continue; } if( v[p] 3 ) return false; } if( l ‘C’) {//C -> 2 | 3BC | 12A if( v[p] 2 ) { p++; continue; } if( v[p] 3 ) { stk.push(‘C’); stk.push(‘B’); p++; continue; } if(p + 2 <= n && v[p] 1 && v[p + 1] 2 ) { p = p + 3; continue; } } } return stk.empty(); } int main() { int m; fin >> m; for(int i = 1; i <= m; i++) { fin >> n; v = vector<int>( n + 1); for(int j = 1; j <= n; j++) fin >> v[j]; if( Perla(‘B’) true || Perla ('C') true || n == 1) fout << “1\n”; else fout << “0\n”; } ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema perle 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ă.