Detalii evaluare #64350976

Rezumat problemă

Se dă un şir format din n numere naturale. Se calculează suma elementelor oricărui subşir al şirului dat. Să se afle câte din sumele obţinute sunt termeni ai şirului lui Fibonacci.

Detalii

Problema Fibonacci3 Operații I/O fibonacci3.in/fibonacci3.out
Limita timp 1.5 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #64350976 Utilizator Programatorul Alexandru (Alexandru33)
Fișier fibonacci3.cpp Dimensiune 1.90 KB
Data încărcării 01 Mai 2026, 14:59 Scor/rezultat Eroare de compilare

Evaluare

Mesaj compilare

fibonacci3.cpp: In function ‘int main()’:
fibonacci3.cpp:15:15: warning: unused variable ‘con’ [-Wunused-variable]
   15 |     int e, s, con=0, n;
      |               ^~~
fibonacci3.cpp: At global scope:
fibonacci3.cpp:50:10: error: redefinition of ‘std::ifstream f’
   50 | ifstream f("dfs.in");
      |          ^
fibonacci3.cpp:6:10: note: ‘std::ifstream f’ previously declared here
    6 | ifstream f("fibonacci3.in");
      |          ^
fibonacci3.cpp:51:10: error: redefinition of ‘std::ofstream g’
   51 | ofstream g("dfs.out");
      |          ^
fibonacci3.cpp:7:10: note: ‘std::ofstream g’ previously declared here
    7 | ofstream g("fibonacci3.out");
      |          ^
fibonacci3.cpp:52:11: error: redefinition of ‘long long int nr_submultimi’
   52 | long long nr_submultimi;
      |           ^~~~~~~~~~~~~
fibonacci3.cpp:8:11: note: ‘long long int nr_submultimi’ previously declared here
    8 | long long nr_submultimi;
      |           ^~~~~~~~~~~~~
fibonacci3.cpp:56:5: error: redefinition of ‘int main()’
   56 | int main(){
      |     ^~~~
fibonacci3.cpp:10:5: note: ‘int main()’ previously defined here
   10 | int main(){
      |     ^~~~
fibonacci3.cpp: In function ‘int main()’:
fibonacci3.cpp:77:19: error: no matching function for call to ‘std::unordered_set<long long int>::insert()’
   77 |         fib.insert();
      |         ~~~~~~~~~~^~
In file included from /usr/include/c++/13/unordered_set:41,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:189,
                 from fibonacci3.cpp:4:
/usr/include/c++/13/bits/unordered_set.h:476:9: note: candidate: ‘template<class _InputIterator> void std::unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(_InputIterator, _InputIterator) [with _Value = long long int; _Hash = std::hash<long long int>; _Pred = std::equal_to<long long int>; _Alloc = std::allocator<long long int>]’
  476 |         insert(_InputIterator __first, _InputIterator __last)
      |         ^~~~~~
/usr/include/c++/13/bits/unordered_set.h:476:9: note:   template argument deduction/substitution failed:
fibonacci3.cpp:77:19: note:   candidate expects 2 arguments, 0 provided
   77 |         fib.insert();
      |         ~~~~~~~~~~^~
/usr/include/c++/13/bits/unordered_set.h:428:7: note: candidate: ‘std::pair<typename std::_Hashtable<_Value, _Value, _Alloc, std::__detail::_Identity, _Pred, _Hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<std::__not_<std::__and_<std::__is_fast_hash<_Hash>, std::__is_nothrow_invocable<const _Hash&, const _Tp&> > >::value, true, true> >::iterator, bool> std::unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(const value_type&) [with _Value = long long int; _Hash = std::hash<long long int>; _Pred = std::equal_to<long long int>; _Alloc = std::allocator<long long int>; typename std::_Hashtable<_Value, _Value, _Alloc, std::__detail::_Identity, _Pred, _Hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<std::__not_<std::__and_<std::__is_fast_hash<_Hash>, std::__is_nothrow_invocable<const _Hash&, const _Tp&> > >::value, true, true> >::iterator = std::__detail::_Insert_base<long long int, long long int, std::allocator<long long int>, std::__detail::_Identity, std::equal_to<long long int>, std::hash<long long int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true> >::iterator; value_type = long long int]’
  428 |       insert(const value_type& __x)
      |       ^~~~~~
/usr/include/c++/13/bits/unordered_set.h:428:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/13/bits/unordered_set.h:432:7: note: candidate: ‘std::pair<typename std::_Hashtable<_Value, _Value, _Alloc, std::__detail::_Identity, _Pred, _Hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<std::__not_<std::__and_<std::__is_fast_hash<_Hash>, std::__is_nothrow_invocable<const _Hash&, const _Tp&> > >::value, true, true> >::iterator, bool> std::unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(value_type&&) [with _Value = long long int; _Hash = std::hash<long long int>; _Pred = std::equal_to<long long int>; _Alloc = std::allocator<long long int>; typename std::_Hashtable<_Value, _Value, _Alloc, std::__detail::_Identity, _Pred, _Hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<std::__not_<std::__and_<std::__is_fast_hash<_Hash>, std::__is_nothrow_invocable<const _Hash&, const _Tp&> > >::value, true, true> >::iterator = std::__detail::_Insert_base<long long int, long long int, std::allocator<long long int>, std::__detail::_Identity, std::equal_to<long long int>, std::hash<long long int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true> >::iterator; value_type = long long int]’
  432 |       insert(value_type&& __x)
      |       ^~~~~~
/usr/include/c++/13/bits/unordered_set.h:432:7: note:   candidate expects 1 argument, 0 provided
/usr/include/c++/13/bits/unordered_set.h:457:7: note: candidate: ‘std::unordered_set<_Value, _Hash, _Pred, _Alloc>::iterator std::unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(const_iterator, const value_type&) [with _Value = long long int; _Hash = std::hash<long long int>; _Pred = std::equal_to<long long int>; _Alloc = std::allocator<long long int>; iterator = std::__detail::_Insert_base<long long int, long long int, std::allocator<long long int>, std::__detail::_Identity, std::equal_to<long long int>, std::hash<long long int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true> >::iterator; const_iterator = std::__detail::_Insert_base<long long int, long long int, std::allocator<long long int>, std::__detail::_Identity, std::equal_to<long long int>, std::hash<long long int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true> >::const_iterator; value_type = long long int]’
  457 |       insert(const_iterator __hint, const value_type& __x)
      |       ^~~~~~
/usr/include/c++/13/bits/unordered_set.h:457:7: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/13/bits/unordered_set.h:461:7: note: candidate: ‘std::unordered_set<_Value, _Hash, _Pred, _Alloc>::iterator std::unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(const_iterator, value_type&&) [with _Value = long long int; _Hash = std::hash<long long int>; _Pred = std::equal_to<long long int>; _Alloc = std::allocator<long long int>; iterator = std::__detail::_Insert_base<long long int, long long int, std::allocator<long long int>, std::__detail::_Identity, std::equal_to<long long int>, std::hash<long long int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true> >::iterator; const_iterator = std::__detail::_Insert_base<long long int, long long int, std::allocator<long long int>, std::__detail::_Identity, std::equal_to<long long int>, std::hash<long long int>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, true, true> >::const_iterator; value_type = long long int]’
  461 |       insert(const_iterator __hint, value_type&& __x)
      |       ^~~~~~
/usr/include/c++/13/bits/unordered_set.h:461:7: note:   candidate expects 2 arguments, 0 provided
/usr/include/c++/13/bits/unordered_set.h:487:7: note: candidate: ‘void std::unordered_set<_Value, _Hash, _Pred, _Alloc>::insert(std::initializer_list<typename std::_Hashtable<_Value, _Value, _Alloc, std::__detail::_Identity, _Pred, _Hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<std::__not_<std::__and_<std::__is_fast_hash<_Hash>, std::__is_nothrow_invocable<const _Hash&, const _Tp&> > >::value, true, true> >::value_type>) [with _Value = long long int; _Hash = std::hash<long long int>; _Pred = std::equal_to<long long int>; _Alloc = std::allocator<long long int>; typename std::_Hashtable<_Value, _Value, _Alloc, std::__detail::_Identity, _Pred, _Hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<std::__not_<std::__and_<std::__is_fast_hash<_Hash>, std::__is_nothrow_invocable<const _Hash&, const _Tp&> > >::value, true, true> >::value_type = long long int]’
  487 |       insert(initializer_list<value_type> __l)
      |       ^~~~~~
/usr/include/c++/13/bits/unordered_set.h:487:7: note:   candidate expects 1 argument, 0 provided
fibonacci3.cpp:61:15: warning: unused variable ‘con’ [-Wunused-variable]
   61 |     int e, s, con=0, n;
      |               ^~~

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 Fibonacci3 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!