#1495
Parcurgând o matrice oarecare pe coloane, să se determine cea mai lungă secvenţă de elemente care sunt numere prime.
| Problema | Memory004 | Operații I/O |
memory004.in/memory004.out
|
|---|---|---|---|
| Limita timp | 0.2 secunde | Limita memorie |
Total: 0.1 MB
/
Stivă 0 MB
|
| Id soluție | #64507230 | Utilizator | |
| Fișier | memory004.cpp | Dimensiune | 1.15 KB |
| Data încărcării | 11 Mai 2026, 18:43 | Scor/rezultat | Eroare de compilare |
memory004.cpp: In function ‘int main()’: memory004.cpp:22:12: error: no match for ‘operator+’ (operand type is ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’}) 22 | + fin >> x; | ^~~~~ memory004.cpp:22:12: note: candidate: ‘operator+(int)’ (built-in) memory004.cpp:22:12: note: no known conversion for argument 1 from ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} to ‘int’ In file included from /usr/include/c++/13/string:48, 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 memory004.cpp:1: /usr/include/c++/13/bits/stl_iterator.h:634:5: note: candidate: ‘template<class _Iterator> std::reverse_iterator<_Iterator> std::operator+(typename reverse_iterator<_Iterator>::difference_type, const reverse_iterator<_Iterator>&)’ 634 | operator+(typename reverse_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:634:5: note: template argument deduction/substitution failed: memory004.cpp:22:14: note: candidate expects 2 arguments, 1 provided 22 | + fin >> x; | ^~~ /usr/include/c++/13/bits/stl_iterator.h:1808:5: note: candidate: ‘template<class _Iterator> std::move_iterator<_IteratorL> std::operator+(typename move_iterator<_IteratorL>::difference_type, const move_iterator<_IteratorL>&)’ 1808 | operator+(typename move_iterator<_Iterator>::difference_type __n, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:1808:5: note: template argument deduction/substitution failed: memory004.cpp:22:14: note: candidate expects 2 arguments, 1 provided 22 | + fin >> x; | ^~~ In file included from /usr/include/c++/13/string:54: /usr/include/c++/13/bits/basic_string.h:3553:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’ 3553 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3553:5: note: template argument deduction/substitution failed: memory004.cpp:22:14: note: ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ 22 | + fin >> x; | ^~~ /usr/include/c++/13/bits/basic_string.h:3571:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’ 3571 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3571:5: note: template argument deduction/substitution failed: memory004.cpp:22:14: note: mismatched types ‘const _CharT*’ and ‘std::basic_ifstream<char>’ 22 | + fin >> x; | ^~~ /usr/include/c++/13/bits/basic_string.h:3590:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’ 3590 | operator+(_CharT __lhs, const basic_string<_CharT,_Traits,_Alloc>& __rhs) | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3590:5: note: template argument deduction/substitution failed: memory004.cpp:22:14: note: candidate expects 2 arguments, 1 provided 22 | + fin >> x; | ^~~ /usr/include/c++/13/bits/basic_string.h:3607:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)’ 3607 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3607:5: note: template argument deduction/substitution failed: memory004.cpp:22:14: note: ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ 22 | + fin >> x; | ^~~ /usr/include/c++/13/bits/basic_string.h:3625:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, _CharT)’ 3625 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs) | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3625:5: note: template argument deduction/substitution failed: memory004.cpp:22:14: note: ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ 22 | + fin >> x; | ^~~ /usr/include/c++/13/bits/basic_string.h:3637:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’ 3637 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3637:5: note: template argument deduction/substitution failed: memory004.cpp:22:14: note: ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} is not derived from ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ 22 | + fin >> x; | ^~~ /usr/include/c++/13/bits/basic_string.h:3644:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&)’ 3644 | operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3644:5: note: template argument deduction/substitution failed: memory004.cpp:22:14: note: ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} is not derived from ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ 22 | + fin >> x; | ^~~ /usr/include/c++/13/bits/basic_string.h:3651:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&)’ 3651 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3651:5: note: template argument deduction/substitution failed: memory004.cpp:22:14: note: ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} is not derived from ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ 22 | + fin >> x; | ^~~ /usr/include/c++/13/bits/basic_string.h:3674:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&)’ 3674 | operator+(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3674:5: note: template argument deduction/substitution failed: memory004.cpp:22:14: note: mismatched types ‘const _CharT*’ and ‘std::basic_ifstream<char>’ 22 | + fin >> x; | ^~~ /usr/include/c++/13/bits/basic_string.h:3681:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, __cxx11::basic_string<_CharT, _Traits, _Alloc>&&)’ 3681 | operator+(_CharT __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3681:5: note: template argument deduction/substitution failed: memory004.cpp:22:14: note: candidate expects 2 arguments, 1 provided 22 | + fin >> x; | ^~~ /usr/include/c++/13/bits/basic_string.h:3688:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, const _CharT*)’ 3688 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3688:5: note: template argument deduction/substitution failed: memory004.cpp:22:14: note: ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} is not derived from ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ 22 | + fin >> x; | ^~~ /usr/include/c++/13/bits/basic_string.h:3695:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::operator+(__cxx11::basic_string<_CharT, _Traits, _Alloc>&&, _CharT)’ 3695 | operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3695:5: note: template argument deduction/substitution failed: memory004.cpp:22:14: note: ‘std::ifstream’ {aka ‘std::basic_ifstream<char>’} is not derived from ‘std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ 22 | + fin >> x; | ^~~ memory004.cpp:38:21: error: ‘cnt’ was not declared in this scope; did you mean ‘int’? 38 | if (cnt[j] > maxim) maxim = cnt[j]; | ^~~ | int memory004.cpp:42:17: error: ‘cnt’ was not declared in this scope; did you mean ‘int’? 42 | cnt[j] = 0; // Secvența de pe coloana j s-a întrerupt | ^~~ | int
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Memory004 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ă.