#3622
Se dă un interval [l,r]
. Aflaţi câte perechi de numere pare se pot forma alegând două numere din interval.
Problema | perechipare | Operații I/O |
![]() |
---|---|---|---|
Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #51334888 | Utilizator | |
Fișier | perechipare.cpp | Dimensiune | 150 B |
Data încărcării | 08 Iunie 2024, 10:13 | Scor / rezultat | Eroare de compilare |
perechipare.cpp: In function 'int main()': perechipare.cpp:7:5: error: 'x' was not declared in this scope x=[r/2]-(l-1)/2; ^ perechipare.cpp:7:9: error: expected ',' before '/' token x=[r/2]-(l-1)/2; ^ perechipare.cpp:7:9: error: expected identifier before '/' token perechipare.cpp: In lambda function: perechipare.cpp:7:12: error: expected '{' before '-' token x=[r/2]-(l-1)/2; ^ perechipare.cpp: In function 'int main()': perechipare.cpp:7:12: error: no match for 'operator-' (operand types are 'main()::__lambda0' and 'long long int') perechipare.cpp:7:12: 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 perechipare.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: perechipare.cpp:7:19: note: 'main()::__lambda0' is not derived from 'const std::reverse_iterator<_Iterator>' x=[r/2]-(l-1)/2; ^ 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 perechipare.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: perechipare.cpp:7:19: note: 'main()::__lambda0' is not derived from 'const std::reverse_iterator<_Iterator>' x=[r/2]-(l-1)/2; ^ 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 perechipare.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: perechipare.cpp:7:19: note: 'main()::__lambda0' is not derived from 'const std::move_iterator<_Iterator>' x=[r/2]-(l-1)/2; ^ 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 perechipare.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: perechipare.cpp:7:19: note: 'main()::__lambda0' is not derived from 'const std::move_iterator<_Iterator>' x=[r/2]-(l-1)/2; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema perechipare 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ă.