#2812
Se dă un șir de cel mult 10
6
numere naturale din intervalul [0,10
3
]
. Se cere să se verifice dacă există un număr natural r
, astfel încât toate numerele distincte din șir să poată fi rearanjate, pentru a forma o progresie aritmetică de rație r
. Se afișează numărul r
, sau mesajul NU
, dacă nu există un astfel de număr.
Subiect Bacalaureat 2017, sesiune august-septembrie
Problema | Progresie3 | Operații I/O |
![]() progresie3.in /progresie3.out
|
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #57701556 | Utilizator | |
Fișier | progresie3.cpp | Dimensiune | 621 B |
Data încărcării | 10 Aprilie 2025, 23:35 | Scor / rezultat | Eroare de compilare |
progresie3.cpp: In function 'int main()': progresie3.cpp:22:8: error: expected identifier before numeric constant r=[1]-v [0]; ^ progresie3.cpp: In lambda function: progresie3.cpp:22:10: error: expected '{' before '-' token r=[1]-v [0]; ^ progresie3.cpp: In function 'int main()': progresie3.cpp:22:10: error: no match for 'operator-' (operand types are 'main()::__lambda0' and 'int') progresie3.cpp:22:10: 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/istream:38, from /usr/include/c++/4.8/fstream:38, from progresie3.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:327:5: note: template<class _Iterator> typename std::reverse_iterator<_Iterator>::difference_type 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:327:5: note: template argument deduction/substitution failed: progresie3.cpp:22:15: note: 'main()::__lambda0' is not derived from 'const std::reverse_iterator<_Iterator>' r=[1]-v [0]; ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from progresie3.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:379:5: note: template<class _IteratorL, class _IteratorR> decltype ((__y.base() - __x.base())) 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:379:5: note: template argument deduction/substitution failed: progresie3.cpp:22:15: note: 'main()::__lambda0' is not derived from 'const std::reverse_iterator<_Iterator>' r=[1]-v [0]; ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from progresie3.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:1104:5: note: template<class _IteratorL, class _IteratorR> decltype ((__x.base() - __y.base())) 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:1104:5: note: template argument deduction/substitution failed: progresie3.cpp:22:15: note: 'main()::__lambda0' is not derived from 'const std::move_iterator<_Iterator>' r=[1]-v [0]; ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from progresie3.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:1111:5: note: template<class _Iterator> decltype ((__x.base() - __y.base())) 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:1111:5: note: template argument deduction/substitution failed: progresie3.cpp:22:15: note: 'main()::__lambda0' is not derived from 'const std::move_iterator<_Iterator>' r=[1]-v [0]; ^ In file included from /usr/include/c++/4.8/vector:65:0, from /usr/include/c++/4.8/bits/random.h:34, from /usr/include/c++/4.8/random:50, from /usr/include/c++/4.8/bits/stl_algo.h:65, from /usr/include/c++/4.8/algorithm:62, from progresie3.cpp:2: /usr/include/c++/4.8/bits/stl_bvector.h:208:3: note: std::ptrdiff_t std::operator-(const std::_Bit_iterator_base&, const std::_Bit_iterator_base&) operator-(const _Bit_iterator_base& __x, const _Bit_iterator_base& __y) ^ /usr/include/c++/4.8/bits/stl_bvector.h:208:3: note: no known conversion for argument 1 from 'main()::__lambda0' to 'const std::_Bit_iterator_base&'
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Progresie3 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ă.