Detalii evaluare #64812454

Rezumat problemă

Se dă o matrice patratică de latură n. Să se determine CMMDC:

  1. pe diagonala principală;
  2. pe diagonala secundară;
  3. conturul matricii.

Detalii

Problema MatGCD_rec Operații I/O tastatură/ecran
Limita timp 0.1 secunde Limita memorie Total: 64 MB / Stivă 64 MB
Id soluție #64812454 Utilizator Becheru Andrei (Becheru_Andrei)
Fișier matgcd_rec.cpp Dimensiune 1.20 KB
Data încărcării 02 Iunie 2026, 22:32 Scor/rezultat Eroare de compilare

Evaluare

Mesaj compilare

matgcd_rec.cpp:5:5: error: expected initializer before ‘if’
    5 |     if (b == 0)
      |     ^~
matgcd_rec.cpp:7:5: error: expected unqualified-id before ‘else’
    7 |     else
      |     ^~~~
matgcd_rec.cpp: In function ‘int findGCDinDiagonal1(std::vector<std::vector<int> >&, int)’:
matgcd_rec.cpp:12:18: error: expected identifier before numeric constant
   12 |     int result =[0][0];
      |                  ^
matgcd_rec.cpp: In lambda function:
matgcd_rec.cpp:12:20: error: expected ‘{’ before ‘[’ token
   12 |     int result =[0][0];
      |                    ^
matgcd_rec.cpp: In function ‘int findGCDinDiagonal1(std::vector<std::vector<int> >&, int)’:
matgcd_rec.cpp:12:20: error: no match for ‘operator[]’ (operand types are ‘findGCDinDiagonal1(std::vector<std::vector<int> >&, int)::<lambda()>’ and ‘int’)
matgcd_rec.cpp:14:28: error: expected ‘)’ before ‘mat’
   14 |         result = gcd(result mat[i][i]);
      |                     ~      ^~~~
      |                            )
matgcd_rec.cpp:14:18: error: ‘gcd’ was not declared in this scope
   14 |         result = gcd(result mat[i][i]);
      |                  ^~~
matgcd_rec.cpp: At global scope:
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
   18 | int findGCDinDiagonal2(vector<vector<int& mat, int n) {
      |                                                    ^
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:52: error: template argument 1 is invalid
matgcd_rec.cpp:18:52: error: template argument 2 is invalid
matgcd_rec.cpp:18:31: error: template argument 1 is invalid
   18 | int findGCDinDiagonal2(vector<vector<int& mat, int n) {
      |                               ^~~~~~~~~~~~~~~~~~~~~~
matgcd_rec.cpp:18:31: error: template argument 2 is invalid
matgcd_rec.cpp: In function ‘int findGCDinBorder(std::vector<std::vector<int> >&, int)’:
matgcd_rec.cpp:26:12: error: wrong number of template arguments (0, should be at least 1)
   26 |     vector<> arr;
      |            ^
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/queue:63,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:157,
                 from matgcd_rec.cpp:1:
/usr/include/c++/13/bits/stl_vector.h:428:11: note: provided for ‘template<class _Tp, class _Alloc> class std::vector’
  428 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
matgcd_rec.cpp:30:21: error: request for member ‘push_back’ in ‘arr’, which is of non-class type ‘int’
   30 |                 arr.push_back([i][j]);
      |                     ^~~~~~~~~
matgcd_rec.cpp: In lambda function:
matgcd_rec.cpp:30:34: error: expected ‘{’ before ‘[’ token
   30 |                 arr.push_back([i][j]);
      |                                  ^
matgcd_rec.cpp: In function ‘int findGCDinBorder(std::vector<std::vector<int> >&, int)’:
matgcd_rec.cpp:30:34: error: no match for ‘operator[]’ (operand types are ‘findGCDinBorder(std::vector<std::vector<int> >&, int)::<lambda()>’ and ‘int’)
matgcd_rec.cpp:32:17: error: request for member ‘push_back’ in ‘arr’, which is of non-class type ‘int’
   32 |             arr.push_back(mat[i][0]);
      |                 ^~~~~~~~~
matgcd_rec.cpp:33:17: error: request for member ‘pushback’ in ‘arr’, which is of non-class type ‘int’
   33 |             arr.pushback(mat[i][n-1]);
      |                 ^~~~~~~~
matgcd_rec.cpp:35:35: error: request for member ‘begin’ in ‘arr’, which is of non-class type ‘int’
   35 |     int result = *max_element(arr.begin(), arr.end
      |                                   ^~~~~
matgcd_rec.cpp:35:48: error: request for member ‘end’ in ‘arr’, which is of non-class type ‘int’
   35 |     int result = *max_element(arr.begin(), arr.end
      |                                                ^~~
matgcd_rec.cpp:35:9: warning: unused variable ‘result’ [-Wunused-variable]
   35 |     int result = *max_element(arr.begin(), arr.end
      |         ^~~~~~
matgcd_rec.cpp:37:1: warning: no return statement in function returning non-void [-Wreturn-type]
   37 | }
      | ^
matgcd_rec.cpp: In function ‘int main()’:
matgcd_rec.cpp:42:10: error: missing template arguments before ‘<<’ token
   42 |    vector<<int>> mat(n, vector<int>(n));
      |          ^~
matgcd_rec.cpp:42:12: error: expected primary-expression before ‘int’
   42 |    vector<<int>> mat(n, vector<int>(n));
      |            ^~~
matgcd_rec.cpp:43:30: error: expected ‘)’ before ‘for’
   43 |    for (int i = 0; i < n; ++i
      |        ~                     ^
      |                              )
   44 |       for (int j=0; j < n; ++j)
      |       ~~~                     
matgcd_rec.cpp:45:18: error: ‘mat’ was not declared in this scope
   45 |           cin >> mat[i][j];
      |                  ^~~
matgcd_rec.cpp:43:4: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
   43 |    for (int i = 0; i < n; ++i
      |    ^~~
matgcd_rec.cpp:46:7: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
   46 |       cout << findGCDinDiagonal1(mat,n)<<" ";
      |       ^~~~
matgcd_rec.cpp:46:34: error: ‘mat’ was not declared in this scope
   46 |       cout << findGCDinDiagonal1(mat,n)<<" ";
      |                                  ^~~
matgcd_rec.cpp:47:12: error: ‘findGCDinDiagonal2mat’ was not declared in this scope; did you mean ‘findGCDinDiagonal2’?
   47 |    cout << findGCDinDiagonal2mat,n)<<" ";
      |            ^~~~~~~~~~~~~~~~~~~~~
      |            findGCDinDiagonal2

Cum funcționează evaluarea?

www.pbinfo.ro permite evaluarea a două tipuri de probleme:

  • probleme la care rezolvarea presupune scrierea unui program complet
  • probleme la care rezolvarea presupune scrierea unei secvențe de program - câteva instrucțiuni, o listă de declarații, una sau mai multe funcții, etc.

Problema MatGCD_rec face parte din prima categorie. Soluția propusă de tine va fi evaluată astfel:

  • Programul sursă este compilat folosind compilatorul corespunzător. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Dacă programul a fost compilat, executabilul obținut va fi rulat, furnizându-i-se unul sau mai multe seturi de date de intrare, în concordanță cu restricțiile specifice problemei. Pentru fiecare set de date se obține un anumit punctaj, în raport cu corectitudinea soluției tale.

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ă.

Du-te sus!