Detalii evaluare #50463148

Rezumat problemă

Se dau n valori naturale. Stabiliți dacă există o progresie aritmetică cu rația număr natural mai mare decât 1 din care să facă parte toate aceste valori.

Detalii

Problema VerifProgresie Operații I/O tastatură/ecran
Limita timp 0.1 secunde Limita memorie Total: 64 MB / Stivă 8 MB
Id soluție #50463148 Utilizator Paraschiv Luca Andrei (Paraschiv_Luca_Andrei)
Fișier verifprogresie.cpp Dimensiune 325 B
Data încărcării 10 Aprilie 2024, 14:07 Scor / rezultat Eroare de compilare

Evaluare


Mesaj compilare

verifprogresie.cpp: In function 'int main()':
verifprogresie.cpp:10:27: warning: capture of variable 'i' with non-automatic storage duration [enabled by default]
          if(v[i]=(v[i+1]+[i-1])/2 && v[i]-v[i-1]=v[i+1]-v[i])

                           ^
verifprogresie.cpp:3:15: note: 'int i' declared here
 int n,v[2500],i;

               ^
verifprogresie.cpp:10:28: error: expected ',' before '-' token
          if(v[i]=(v[i+1]+[i-1])/2 && v[i]-v[i-1]=v[i+1]-v[i])

                            ^
verifprogresie.cpp:10:28: error: expected identifier before '-' token
verifprogresie.cpp: In lambda function:
verifprogresie.cpp:10:31: error: expected '{' before ')' token
          if(v[i]=(v[i+1]+[i-1])/2 && v[i]-v[i-1]=v[i+1]-v[i])

                               ^
verifprogresie.cpp: In function 'int main()':
verifprogresie.cpp:10:25: error: no match for 'operator+' (operand types are 'int' and 'main()::__lambda0')
          if(v[i]=(v[i+1]+[i-1])/2 && v[i]-v[i-1]=v[i+1]-v[i])

                         ^
verifprogresie.cpp:10:25: note: candidates are:
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 verifprogresie.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:333:5: note: template<class _Iterator> std::reverse_iterator<_Iterator> std::operator+(typename std::reverse_iterator<_Iterator>::difference_type, const std::reverse_iterator<_Iterator>&)
     operator+(typename reverse_iterator<_Iterator>::difference_type __n,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:333:5: note:   template argument deduction/substitution failed:
verifprogresie.cpp:10:31: note:   'main()::__lambda0' is not derived from 'const std::reverse_iterator<_Iterator>'
          if(v[i]=(v[i+1]+[i-1])/2 && v[i]-v[i-1]=v[i+1]-v[i])

                               ^
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 verifprogresie.cpp:1:
/usr/include/c++/4.8/bits/stl_iterator.h:1118:5: note: template<class _Iterator> std::move_iterator<_Iterator> std::operator+(typename std::move_iterator<_Iterator>::difference_type, const std::move_iterator<_Iterator>&)
     operator+(typename move_iterator<_Iterator>::difference_type __n,
     ^
/usr/include/c++/4.8/bits/stl_iterator.h:1118:5: note:   template argument deduction/substitution failed:
verifprogresie.cpp:10:31: note:   'main()::__lambda0' is not derived from 'const std::move_iterator<_Iterator>'
          if(v[i]=(v[i+1]+[i-1])/2 && v[i]-v[i-1]=v[i+1]-v[i])

                               ^
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 verifprogresie.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2365:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> 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:2365:5: note:   template argument deduction/substitution failed:
verifprogresie.cpp:10:31: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
          if(v[i]=(v[i+1]+[i-1])/2 && v[i]-v[i-1]=v[i+1]-v[i])

                               ^
In file included from /usr/include/c++/4.8/string:53: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 verifprogresie.cpp:1:
/usr/include/c++/4.8/bits/basic_string.tcc:692:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, const std::basic_string<_CharT, _Traits, _Alloc>&)
     operator+(const _CharT* __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.tcc:692:5: note:   template argument deduction/substitution failed:
verifprogresie.cpp:10:31: note:   mismatched types 'const _CharT*' and 'int'
          if(v[i]=(v[i+1]+[i-1])/2 && v[i]-v[i-1]=v[i+1]-v[i])

                               ^
In file included from /usr/include/c++/4.8/string:53: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 verifprogresie.cpp:1:
/usr/include/c++/4.8/bits/basic_string.tcc:708:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, const std::basic_string<_CharT, _Traits, _Alloc>&)
     operator+(_CharT __lhs, const basic_string<_CharT, _Traits, _Alloc>& __rhs)
     ^
/usr/include/c++/4.8/bits/basic_string.tcc:708:5: note:   template argument deduction/substitution failed:
verifprogresie.cpp:10:31: note:   'main()::__lambda0' is not derived from 'const std::basic_string<_CharT, _Traits, _Alloc>'
          if(v[i]=(v[i+1]+[i-1])/2 && v[i]-v[i-1]=v[i+1]-v[i])

                               ^
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 verifprogresie.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2402:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> 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:2402:5: note:   template argument deduction/substitution failed:
verifprogresie.cpp:10:31: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
          if(v[i]=(v[i+1]+[i-1])/2 && v[i]-v[i-1]=v[i+1]-v[i])

                               ^
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 verifprogresie.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2418:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::basic_string<_CharT, _Traits, _Alloc>&, _CharT)
     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs, _CharT __rhs)
     ^
/usr/include/c++/4.8/bits/basic_string.h:2418:5: note:   template argument deduction/substitution failed:
verifprogresie.cpp:10:31: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
          if(v[i]=(v[i+1]+[i-1])/2 && v[i]-v[i-1]=v[i+1]-v[i])

                               ^
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 verifprogresie.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2430:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::basic_string<_CharT, _Traits, _Alloc>&&, const std::basic_string<_CharT, _Traits, _Alloc>&)
     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2430:5: note:   template argument deduction/substitution failed:
verifprogresie.cpp:10:31: note:   mismatched types 'std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
          if(v[i]=(v[i+1]+[i-1])/2 && v[i]-v[i-1]=v[i+1]-v[i])

                               ^
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 verifprogresie.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2436:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(const std::basic_string<_CharT, _Traits, _Alloc>&, std::basic_string<_CharT, _Traits, _Alloc>&&)
     operator+(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2436:5: note:   template argument deduction/substitution failed:
verifprogresie.cpp:10:31: note:   mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
          if(v[i]=(v[i+1]+[i-1])/2 && v[i]-v[i-1]=v[i+1]-v[i])

                               ^
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 verifprogresie.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2442:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::basic_string<_CharT, _Traits, _Alloc>&&, std::basic_string<_CharT, _Traits, _Alloc>&&)
     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2442:5: note:   template argument deduction/substitution failed:
verifprogresie.cpp:10:31: note:   mismatched types 'std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
          if(v[i]=(v[i+1]+[i-1])/2 && v[i]-v[i-1]=v[i+1]-v[i])

                               ^
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 verifprogresie.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2454:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(const _CharT*, std::basic_string<_CharT, _Traits, _Alloc>&&)
     operator+(const _CharT* __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2454:5: note:   template argument deduction/substitution failed:
verifprogresie.cpp:10:31: note:   mismatched types 'const _CharT*' and 'int'
          if(v[i]=(v[i+1]+[i-1])/2 && v[i]-v[i-1]=v[i+1]-v[i])

                               ^
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 verifprogresie.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2460:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(_CharT, std::basic_string<_CharT, _Traits, _Alloc>&&)
     operator+(_CharT __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2460:5: note:   template argument deduction/substitution failed:
verifprogresie.cpp:10:31: note:   'main()::__lambda0' is not derived from 'std::basic_string<_CharT, _Traits, _Alloc>'
          if(v[i]=(v[i+1]+[i-1])/2 && v[i]-v[i-1]=v[i+1]-v[i])

                               ^
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 verifprogresie.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2466:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::basic_string<_CharT, _Traits, _Alloc>&&, const _CharT*)
     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2466:5: note:   template argument deduction/substitution failed:
verifprogresie.cpp:10:31: note:   mismatched types 'std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
          if(v[i]=(v[i+1]+[i-1])/2 && v[i]-v[i-1]=v[i+1]-v[i])

                               ^
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 verifprogresie.cpp:1:
/usr/include/c++/4.8/bits/basic_string.h:2472:5: note: template<class _CharT, class _Traits, class _Alloc> std::basic_string<_CharT, _Traits, _Alloc> std::operator+(std::basic_string<_CharT, _Traits, _Alloc>&&, _CharT)
     operator+(basic_string<_CharT, _Traits, _Alloc>&& __lhs,
     ^
/usr/include/c++/4.8/bits/basic_string.h:2472:5: note:   template argument deduction/substitution failed:
verifprogresie.cpp:10:31: note:   mismatched types 'std::basic_string<_CharT, _Traits, _Alloc>' and 'int'
          if(v[i]=(v[i+1]+[i-1])/2 && v[i]-v[i-1]=v[i+1]-v[i])

                               ^
verifprogresie.cpp:10:12: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]
          if(v[i]=(v[i+1]+[i-1])/2 && v[i]-v[i-1]=v[i+1]-v[i])

            ^
verifprogresie.cpp:15:10: error: 'reutrn' was not declared in this scope
          reutrn 0;

          ^
verifprogresie.cpp:15:17: error: expected ';' before numeric constant
          reutrn 0;

                 ^

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