#998
Se consideră o matrice pătratică cu n linii şi n coloane şi elemente numere naturale. Să se modifice matricea în felul următor: toate elementele de pe liniile care conţin valoare maximă din matrice vor fi mărite cu valoarea minimă din matrice.
| Problema | Matrice6 | Operații I/O |
matrice6.in/matrice6.out
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64762275 | Utilizator | |
| Fișier | matrice6.cpp | Dimensiune | 836 B |
| Data încărcării | 28 Mai 2026, 13:11 | Scor/rezultat | Eroare de compilare |
matrice6.cpp: In function ‘int main()’: matrice6.cpp:16:26: error: reference to ‘max’ is ambiguous 16 | if(a[i][j] > max) max = a[i][j]; | ^~~ In file included from /usr/include/c++/13/string:51, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/ios:44, from /usr/include/c++/13/istream:40, from /usr/include/c++/13/fstream:40, from matrice6.cpp:1: /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidates are: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ matrice6.cpp:6:10: note: ‘int max’ 6 | int n , max = -1 , min = 1000000001 , a[101][101],c; | ^~~ matrice6.cpp:16:31: error: reference to ‘max’ is ambiguous 16 | if(a[i][j] > max) max = a[i][j]; | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidates are: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ matrice6.cpp:6:10: note: ‘int max’ 6 | int n , max = -1 , min = 1000000001 , a[101][101],c; | ^~~ matrice6.cpp:17:26: error: reference to ‘min’ is ambiguous 17 | if(a[i][j] < min) min = a[i][j]; | ^~~ /usr/include/c++/13/bits/stl_algobase.h:281:5: note: candidates are: ‘template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)’ 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:233:5: note: ‘template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)’ 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ matrice6.cpp:6:21: note: ‘int min’ 6 | int n , max = -1 , min = 1000000001 , a[101][101],c; | ^~~ matrice6.cpp:17:31: error: reference to ‘min’ is ambiguous 17 | if(a[i][j] < min) min = a[i][j]; | ^~~ /usr/include/c++/13/bits/stl_algobase.h:281:5: note: candidates are: ‘template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)’ 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:233:5: note: ‘template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)’ 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ matrice6.cpp:6:21: note: ‘int min’ 6 | int n , max = -1 , min = 1000000001 , a[101][101],c; | ^~~ matrice6.cpp:25:27: error: reference to ‘max’ is ambiguous 25 | if(a[i][j] == max) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:303:5: note: candidates are: ‘template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)’ 303 | max(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:257:5: note: ‘template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)’ 257 | max(const _Tp& __a, const _Tp& __b) | ^~~ matrice6.cpp:6:10: note: ‘int max’ 6 | int n , max = -1 , min = 1000000001 , a[101][101],c; | ^~~ matrice6.cpp:29:30: error: ‘j’ was not declared in this scope 29 | for( j = 1 ; j <= n ;j++) | ^ matrice6.cpp:30:31: error: reference to ‘min’ is ambiguous 30 | fout << a[i][j] + min << " "; | ^~~ /usr/include/c++/13/bits/stl_algobase.h:281:5: note: candidates are: ‘template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)’ 281 | min(const _Tp& __a, const _Tp& __b, _Compare __comp) | ^~~ /usr/include/c++/13/bits/stl_algobase.h:233:5: note: ‘template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)’ 233 | min(const _Tp& __a, const _Tp& __b) | ^~~ matrice6.cpp:6:21: note: ‘int min’ 6 | int n , max = -1 , min = 1000000001 , a[101][101],c; | ^~~ matrice6.cpp:32:30: error: ‘j’ was not declared in this scope 32 | for(j = 1 ; j <= n ;j++) | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Matrice6 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ă.