#1585
GenMat23
Scrieţi un program care citeşte de la tastatură un număr natural n
şi construieşte o matrice pătratică având n
linii şi n
coloane, cu elemente 0
şi 1
, dispuse în pătrate concentrice, fiecare pătrat fiind format doar din valori 1
sau doar din valori 0
, conform exemplului, astfel încât elementul aflat pe prima linie şi prima coloană să fie egal cu 1
.
Variante Bacalaureat 2007
Problema | GenMat23 | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #10003446 | Utilizator | |
Fișier | genmat23.cpp | Dimensiune | 490 B |
Data încărcării | 11 Iulie 2018, 12:07 | Scor / rezultat | Eroare de compilare |
genmat23.cpp:2:7: error: expected nested-name-specifier before 'namspace' using namspace std; ^ genmat23.cpp:2:7: error: 'namspace' has not been declared genmat23.cpp:2:16: error: expected ';' before 'std' using namspace std; ^ genmat23.cpp:2:16: error: 'std' does not name a type genmat23.cpp: In function 'int main()': genmat23.cpp:6:5: error: 'cin' was not declared in this scope cin>>n; ^ genmat23.cpp:6:5: note: suggested alternative: In file included from genmat23.cpp:1:0: /usr/include/c++/4.8/iostream:60:18: note: 'std::cin' extern istream cin; /// Linked to standard input ^ genmat23.cpp:9:27: error: 'a' was not declared in this scope for(int j=1;j<=n;j++)a[i][j]=p; ^ genmat23.cpp:10:28: error: 'a' was not declared in this scope for(int j=1;j<=n;j++)a[n-i+1][j]=p; ^ genmat23.cpp:11:30: error: 'a' was not declared in this scope for(int j=1;j<=n;j++)a[j][i]=p; ^ genmat23.cpp:12:30: error: 'a' was not declared in this scope for(int j=1;j<=n;j++)a[j][n-1+1]=p; ^ genmat23.cpp:20:6: error: 'cout' was not declared in this scope cout<<a[i][j]<<" "; ^ genmat23.cpp:20:6: note: suggested alternative: In file included from genmat23.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: 'std::cout' extern ostream cout; /// Linked to standard output ^ genmat23.cpp:20:12: error: 'a' was not declared in this scope cout<<a[i][j]<<" "; ^ genmat23.cpp:21:6: error: 'cout' was not declared in this scope cout<<endl; ^ genmat23.cpp:21:6: note: suggested alternative: In file included from genmat23.cpp:1:0: /usr/include/c++/4.8/iostream:61:18: note: 'std::cout' extern ostream cout; /// Linked to standard output ^ genmat23.cpp:21:12: error: 'endl' was not declared in this scope cout<<endl; ^ genmat23.cpp:21:12: note: suggested alternative: In file included from /usr/include/c++/4.8/iostream:39:0, from genmat23.cpp:1: /usr/include/c++/4.8/ostream:564:5: note: 'std::endl' endl(basic_ostream<_CharT, _Traits>& __os) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema GenMat23 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ă.