Detalii evaluare #51380553

Rezumat problemă

#72 FSumVec C++

Scrieți definiția completă unui subprogram C++ care returnează suma elementelor unui tablou unidimensional cu indici din afara unui interval dat.

Detalii

Problema FSumVec Operații I/O tastatură/ecran
Limita timp 0.1 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #51380553 Utilizator red win (Stefano_888)
Fișier fsumvec.cpp Dimensiune 179 B
Data încărcării 11 Iunie 2024, 18:15 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

fsumvec.cpp: In function 'int suma(int (*)[101], int, int, int)':
fsumvec.cpp:9:34: error: expected ',' before '+' token
      if(v[a]<=v[i-1] and v[a]>=[j+1])

                                  ^
fsumvec.cpp:9:34: error: expected identifier before '+' token
fsumvec.cpp: In lambda function:
fsumvec.cpp:9:37: error: expected '{' before ')' token
      if(v[a]<=v[i-1] and v[a]>=[j+1])

                                     ^
fsumvec.cpp: In function 'int suma(int (*)[101], int, int, int)':
fsumvec.cpp:9:30: error: no match for 'operator>=' (operand types are 'int [101]' and 'suma(int (*)[101], int, int, int)::__lambda0')
      if(v[a]<=v[i-1] and v[a]>=[j+1])

                              ^
fsumvec.cpp:9:30: note: candidates are:
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from fsumvec.cpp:1:
/usr/include/c++/4.8/bits/stl_pair.h:245:5: note: template<class _T1, class _T2> constexpr bool std::operator>=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)
     operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
     ^
/usr/include/c++/4.8/bits/stl_pair.h:245:5: note:   template argument deduction/substitution failed:
fsumvec.cpp:9:37: note:   mismatched types 'const std::pair<_T1, _T2>' and 'int [101]'
      if(v[a]<=v[i-1] and v[a]>=[j+1])

                                     ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from fsumvec.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:321:5: note: template<class _Iterator> bool std::operator>=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)
     operator>=(const reverse_iterator<_Iterator>& __x,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:321:5: note:   template argument deduction/substitution failed:
fsumvec.cpp:9:37: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int [101]'
      if(v[a]<=v[i-1] and v[a]>=[j+1])

                                     ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from fsumvec.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:371:5: note: template<class _IteratorL, class _IteratorR> bool std::operator>=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)
     operator>=(const reverse_iterator<_IteratorL>& __x,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:371:5: note:   template argument deduction/substitution failed:
fsumvec.cpp:9:37: note:   mismatched types 'const std::reverse_iterator<_Iterator>' and 'int [101]'
      if(v[a]<=v[i-1] and v[a]>=[j+1])

                                     ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from fsumvec.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:1091:5: note: template<class _IteratorL, class _IteratorR> bool std::operator>=(const std::move_iterator<_Iterator>&, const std::move_iterator<_IteratorR>&)
     operator>=(const move_iterator<_IteratorL>& __x,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:1091:5: note:   template argument deduction/substitution failed:
fsumvec.cpp:9:37: note:   mismatched types 'const std::move_iterator<_Iterator>' and 'int [101]'
      if(v[a]<=v[i-1] and v[a]>=[j+1])

                                     ^
In file included from /usr/include/c++/4.8/bits/stl_algobase.h:67:0,
                 from /usr/include/c++/4.8/bits/char_traits.h:39,
                 from /usr/include/c++/4.8/ios:40,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from fsumvec.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:1097:5: note: template<class _Iterator> bool std::operator>=(const std::move_iterator<_Iterator>&, const std::move_iterator<_Iterator>&)
     operator>=(const move_iterator<_Iterator>& __x,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:1097:5: note:   template argument deduction/substitution failed:
fsumvec.cpp:9:37: note:   mismatched types 'const std::move_iterator<_Iterator>' and 'int [101]'
      if(v[a]<=v[i-1] and v[a]>=[j+1])

                                     ^
In file included from /usr/include/c++/4.8/string:52:0,
                 from /usr/include/c++/4.8/bits/locale_classes.h:40,
                 from /usr/include/c++/4.8/bits/ios_base.h:41,
                 from /usr/include/c++/4.8/ios:42,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from fsumvec.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2680:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator>=(const std::basic_string<_CharT, _Traits, _Alloc>&, const std::basic_string<_CharT, _Traits, _Alloc>&)
     operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2680:5: note:   template argument deduction/substitution failed:
fsumvec.cpp:9:37: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int [101]'
      if(v[a]<=v[i-1] and v[a]>=[j+1])

                                     ^
In file included from /usr/include/c++/4.8/string:52:0,
                 from /usr/include/c++/4.8/bits/locale_classes.h:40,
                 from /usr/include/c++/4.8/bits/ios_base.h:41,
                 from /usr/include/c++/4.8/ios:42,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from fsumvec.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2692:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator>=(const std::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)
     operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2692:5: note:   template argument deduction/substitution failed:
fsumvec.cpp:9:37: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int [101]'
      if(v[a]<=v[i-1] and v[a]>=[j+1])

                                     ^
In file included from /usr/include/c++/4.8/string:52:0,
                 from /usr/include/c++/4.8/bits/locale_classes.h:40,
                 from /usr/include/c++/4.8/bits/ios_base.h:41,
                 from /usr/include/c++/4.8/ios:42,
                 from /usr/include/c++/4.8/ostream:38,
                 from /usr/include/c++/4.8/iostream:39,
                 from fsumvec.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2704:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator>=(const _CharT*, const std::basic_string<_CharT, _Traits, _Alloc>&)
     operator>=(const _CharT* __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2704:5: note:   template argument deduction/substitution failed:
fsumvec.cpp:9:37: note:   'suma(int (*)[101], int, int, int)::__lambda0' is not derived from 'const std::basic_string<_CharT, _Traits, _Alloc>'
      if(v[a]<=v[i-1] and v[a]>=[j+1])

                                     ^
fsumvec.cpp:10:12: error: invalid conversion from 'int*' to 'int' [-fpermissive]
         s=s+v[a];

            ^
fsumvec.cpp: In function 'int main()':
fsumvec.cpp:21:25: error: cannot convert 'int*' to 'int (*)[101]' for argument '1' to 'int suma(int (*)[101], int, int, int)'
  cout << suma(v, n, i, j);

                         ^

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 FSumVec face parte din a doua categorie. Pentru aceste probleme se folosește un program suport, furnizat de propunătorul problemei. Soluția propusă de tine va fi evaluată astfel:

  • Soluția propusă de tine este inclusă în programul suport, apoi acesta este compilat. Dacă în urma compilării se obțin erori sau avertismente, acestea sunt afișate în această pagină.
  • Datorită existenței programului suport, la compilare pot să apară erori sau avertismente care să nu se refere la instrucțiunile scrise de tine, dar care sunt datorate faptului că soluția ta nu este corectă.
  • Dacă programul suport 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ă.