#211
Să se parcurgă o matrice pătratică în spirală în sensul acelor de ceasornic.
| Problema | Spirala | Operații I/O |
spirala.in/spirala.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64900237 | Utilizator | |
| Fișier | spirala.cpp | Dimensiune | 747 B |
| Data încărcării | 10 Iunie 2026, 18:49 | Scor/rezultat | Eroare de compilare |
spirala.cpp:4:27: error: no matching function for call to ‘std::basic_ostream<char>::basic_ostream(const char [12])’ 4 | ostream fout("spirala.out"); | ^ In file included from /usr/include/c++/13/istream:41, from /usr/include/c++/13/fstream:40, from spirala.cpp:1: /usr/include/c++/13/ostream:436:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::basic_ostream(std::basic_iostream<_CharT, _Traits>&) [with _CharT = char; _Traits = std::char_traits<char>]’ 436 | basic_ostream(basic_iostream<_CharT, _Traits>&) { } | ^~~~~~~~~~~~~ /usr/include/c++/13/ostream:436:21: note: no known conversion for argument 1 from ‘const char [12]’ to ‘std::basic_iostream<char>&’ 436 | basic_ostream(basic_iostream<_CharT, _Traits>&) { } | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/ostream:440:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::basic_ostream(std::basic_ostream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]’ 440 | basic_ostream(basic_ostream&& __rhs) | ^~~~~~~~~~~~~ /usr/include/c++/13/ostream:440:37: note: no known conversion for argument 1 from ‘const char [12]’ to ‘std::basic_ostream<char>&&’ 440 | basic_ostream(basic_ostream&& __rhs) | ~~~~~~~~~~~~~~~~^~~~~ /usr/include/c++/13/ostream:431:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::basic_ostream() [with _CharT = char; _Traits = std::char_traits<char>]’ 431 | basic_ostream() | ^~~~~~~~~~~~~ /usr/include/c++/13/ostream:431:7: note: candidate expects 0 arguments, 1 provided /usr/include/c++/13/ostream:86:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>::basic_ostream(__streambuf_type*) [with _CharT = char; _Traits = std::char_traits<char>; __streambuf_type = std::basic_streambuf<char>]’ 86 | basic_ostream(__streambuf_type* __sb) | ^~~~~~~~~~~~~ /usr/include/c++/13/ostream:86:39: note: no known conversion for argument 1 from ‘const char [12]’ to ‘std::basic_ostream<char>::__streambuf_type*’ {aka ‘std::basic_streambuf<char>*’} 86 | basic_ostream(__streambuf_type* __sb) | ~~~~~~~~~~~~~~~~~~^~~~ spirala.cpp: In function ‘int main()’: spirala.cpp:7:13: error: ‘i’ was not declared in this scope 7 | int n,a[i][j],afisate; | ^ spirala.cpp:7:16: error: ‘j’ was not declared in this scope 7 | int n,a[i][j],afisate; | ^ spirala.cpp:13:20: error: ‘a’ was not declared in this scope 13 | fin >> a[i][j]; | ^ spirala.cpp:16:18: error: ‘k’ was not declared in this scope 16 | for (int j = k; j <= n+1-k; j++) | ^ spirala.cpp:18:18: error: ‘a’ was not declared in this scope 18 | fout << a[k][j] << ' '; | ^ spirala.cpp:21:18: error: ‘k’ was not declared in this scope 21 | for (int i = k + 1; i <= k; i++) | ^ spirala.cpp:23:18: error: ‘a’ was not declared in this scope 23 | fout << a[i][n+1-k]; | ^ spirala.cpp:26:22: error: ‘k’ was not declared in this scope 26 | for (int j = n+1-k - 1; j >= k; j--) | ^ spirala.cpp:28:18: error: ‘a’ was not declared in this scope 28 | fout << a[n+1-k][j] << ' '; | ^ spirala.cpp:32:18: error: ‘k’ was not declared in this scope 32 | for (int i = k - 1; i > k ; i--) | ^ spirala.cpp:34:18: error: ‘a’ was not declared in this scope 34 | fout << a[i][k] << ' '; | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Spirala 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ă.