#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 | #14704947 | Utilizator | |
Fișier | genmat23.cpp | Dimensiune | 682 B |
Data încărcării | 14 Martie 2019, 11:58 | Scor / rezultat | Eroare de compilare |
genmat23.cpp:6:1: error: stray '\302' in program cin>>n; ^ genmat23.cpp:6:1: error: stray '\240' in program genmat23.cpp:7:1: error: stray '\302' in program for(r=1;r<=n/2+n%2;r++) ^ genmat23.cpp:7:1: error: stray '\240' in program genmat23.cpp:8:1: error: stray '\302' in program {for(j=r;j<=n-r+1;j++) ^ genmat23.cpp:8:1: error: stray '\240' in program genmat23.cpp:10:1: error: stray '\302' in program M[r][j]=0; ^ genmat23.cpp:10:1: error: stray '\240' in program genmat23.cpp:10:1: error: stray '\302' in program genmat23.cpp:10:1: error: stray '\240' in program genmat23.cpp:10:1: error: stray '\302' in program genmat23.cpp:10:1: error: stray '\240' in program genmat23.cpp:13:1: error: stray '\302' in program for(i=r+1;i<=n-r+1;i++) ^ genmat23.cpp:13:1: error: stray '\240' in program genmat23.cpp:15:1: error: stray '\302' in program M[i][r]=0; ^ genmat23.cpp:15:1: error: stray '\240' in program genmat23.cpp:15:1: error: stray '\302' in program genmat23.cpp:15:1: error: stray '\240' in program genmat23.cpp:15:1: error: stray '\302' in program genmat23.cpp:15:1: error: stray '\240' in program genmat23.cpp:18:1: error: stray '\302' in program for(r=n;r>=1;r--) ^ genmat23.cpp:18:1: error: stray '\240' in program genmat23.cpp:19:1: error: stray '\302' in program {for(j=n-r+1;j>=r;j--) ^ genmat23.cpp:19:1: error: stray '\240' in program genmat23.cpp:21:1: error: stray '\302' in program M[n-r+1][j]=0; ^ genmat23.cpp:21:1: error: stray '\240' in program genmat23.cpp:21:1: error: stray '\302' in program genmat23.cpp:21:1: error: stray '\240' in program genmat23.cpp:21:1: error: stray '\302' in program genmat23.cpp:21:1: error: stray '\240' in program genmat23.cpp:24:1: error: stray '\302' in program for(i=n-r+1;i>=r;i--) ^ genmat23.cpp:24:1: error: stray '\240' in program genmat23.cpp:26:1: error: stray '\302' in program M[i][n-r+1]=0; ^ genmat23.cpp:26:1: error: stray '\240' in program genmat23.cpp:26:1: error: stray '\302' in program genmat23.cpp:26:1: error: stray '\240' in program genmat23.cpp:26:1: error: stray '\302' in program genmat23.cpp:26:1: error: stray '\240' in program genmat23.cpp:30:1: error: stray '\302' in program for(i=1;i<=n;i++) ^ genmat23.cpp:30:1: error: stray '\240' in program genmat23.cpp:31:1: error: stray '\302' in program {for(j=1;j<=n;j++) ^ genmat23.cpp:31:1: error: stray '\240' in program genmat23.cpp:32:1: error: stray '\302' in program cout<<M[i][j]<<" "; ^ genmat23.cpp:32:1: error: stray '\240' in program genmat23.cpp:32:1: error: stray '\302' in program genmat23.cpp:32:1: error: stray '\240' in program genmat23.cpp:32:1: error: stray '\302' in program genmat23.cpp:32:1: error: stray '\240' in program genmat23.cpp:33:1: error: stray '\302' in program cout<<endl; ^ genmat23.cpp:33:1: error: stray '\240' in program genmat23.cpp:35:1: error: stray '\302' in program return 0; ^ genmat23.cpp:35:1: error: stray '\240' in program genmat23.cpp:36:1: error: stray '\302' in program } ^ genmat23.cpp:36:1: error: stray '\240' in program genmat23.cpp:30:3: error: expected unqualified-id before 'for' for(i=1;i<=n;i++) ^ genmat23.cpp:30:11: error: 'i' does not name a type for(i=1;i<=n;i++) ^ genmat23.cpp:30:16: error: 'i' does not name a type for(i=1;i<=n;i++) ^ genmat23.cpp:35:3: error: expected unqualified-id before 'return' return 0; ^ genmat23.cpp:36:3: error: expected declaration before '}' token } ^
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ă.