#1008
Spirala1
Se dau n
numere naturale, un n
este un pătrat perfect. Să se construiască în memorie o matrice pătratică cu toate cele n
numere, în spirală, în sens invers acelor de ceas astfel: pe prima coloană, începând cu linia 1
, se vor trece primele elemente din şir (de sus în jos), apoi pe ultima linie, începând de la prima coloană până la ultima (de la stânga la dreapta), apoi pe ultima coloană, de la ultima linie la prima (de jos în sus), apoi pe prima linie, de la ultima coloană la prima (de la dreapta la stânga) şamd.
Problema | Spirala1 | Operații I/O |
spirala1.in /spirala1.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #50891720 | Utilizator | |
Fișier | spirala1.cpp | Dimensiune | 1.01 KB |
Data încărcării | 13 Mai 2024, 08:33 | Scor / rezultat | Eroare de compilare |
spirala1.cpp: In function 'int main()': spirala1.cpp:11:5: error: reference to 'cin' is ambiguous cin >> n; ^ spirala1.cpp:4:10: note: candidates are: std::ifstream cin ifstream cin("spirala1.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from spirala1.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ spirala1.cpp:15:5: error: reference to 'cin' is ambiguous cin >> a[x][y]; ^ spirala1.cpp:4:10: note: candidates are: std::ifstream cin ifstream cin("spirala1.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from spirala1.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ spirala1.cpp:22:13: error: reference to 'cin' is ambiguous cin >> a[x][y]; ^ spirala1.cpp:4:10: note: candidates are: std::ifstream cin ifstream cin("spirala1.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from spirala1.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ spirala1.cpp:28:13: error: reference to 'cin' is ambiguous cin >> a[x][y]; ^ spirala1.cpp:4:10: note: candidates are: std::ifstream cin ifstream cin("spirala1.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from spirala1.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ spirala1.cpp:34:13: error: reference to 'cin' is ambiguous cin >> a[x][y]; ^ spirala1.cpp:4:10: note: candidates are: std::ifstream cin ifstream cin("spirala1.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from spirala1.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ spirala1.cpp:40:13: error: reference to 'cin' is ambiguous cin >> a[x][y]; ^ spirala1.cpp:4:10: note: candidates are: std::ifstream cin ifstream cin("spirala1.in"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from spirala1.cpp:1: /usr/include/c++/4.8/iostream:60:18: note: std::istream std::cin extern istream cin; /// Linked to standard input ^ spirala1.cpp:47:13: error: reference to 'cout' is ambiguous cout << a[i][j] << ' '; ^ spirala1.cpp:5:10: note: candidates are: std::ofstream cout ofstream cout("spirala1.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from spirala1.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^ spirala1.cpp:48:9: error: reference to 'cout' is ambiguous cout << endl; ^ spirala1.cpp:5:10: note: candidates are: std::ofstream cout ofstream cout("spirala1.out"); ^ In file included from /usr/include/i386-linux-gnu/c++/4.8/bits/stdc++.h:74:0, from spirala1.cpp:1: /usr/include/c++/4.8/iostream:61:18: note: std::ostream std::cout extern ostream cout; /// Linked to standard output ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Spirala1 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ă.