#2619
five
Se consideră un șir de numere naturale a[1]
, a[2]
, …, a[n]
. Să se determine numărul tripletelor (a[i], a[j], a[p])
cu i < j < p
, iar a[i] + a[j] + a[p]
este divizibil cu 5
.
Folclorul informatic
Problema | five | Operații I/O | tastatură/ecran |
---|---|---|---|
Limita timp | 0.5 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #54471256 | Utilizator | |
Fișier | five.cpp | Dimensiune | 659 B |
Data încărcării | 29 Noiembrie 2024, 11:41 | Scor / rezultat | Eroare de compilare |
five.cpp: In function 'int main()': five.cpp:26:5: error: expected ';' before 'sol' sol+=v[0]*v[1]*v[4]; ^ five.cpp:28:23: error: expected identifier before numeric constant sol+=v[1]*v[2]*v([2]-1)/2; ^ five.cpp: In lambda function: five.cpp:28:25: error: expected '{' before '-' token sol+=v[1]*v[2]*v([2]-1)/2; ^ five.cpp: In function 'int main()': five.cpp:28:25: error: no match for 'operator-' (operand types are 'main()::__lambda0' and 'int') five.cpp:28: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 five.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: five.cpp:28:26: note: 'main()::__lambda0' is not derived from 'const std::reverse_iterator<_Iterator>' sol+=v[1]*v[2]*v([2]-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 five.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: five.cpp:28:26: note: 'main()::__lambda0' is not derived from 'const std::reverse_iterator<_Iterator>' sol+=v[1]*v[2]*v([2]-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 five.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: five.cpp:28:26: note: 'main()::__lambda0' is not derived from 'const std::move_iterator<_Iterator>' sol+=v[1]*v[2]*v([2]-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 five.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: five.cpp:28:26: note: 'main()::__lambda0' is not derived from 'const std::move_iterator<_Iterator>' sol+=v[1]*v[2]*v([2]-1)/2; ^ five.cpp:28:27: error: 'v' cannot be used as a function sol+=v[1]*v[2]*v([2]-1)/2; ^ five.cpp:29:23: error: expected identifier before numeric constant sol+=v[3]*v[1]*v([1]-1)/2; ^ five.cpp: In lambda function: five.cpp:29:25: error: expected '{' before '-' token sol+=v[3]*v[1]*v([1]-1)/2; ^ five.cpp: In function 'int main()': five.cpp:29:25: error: no match for 'operator-' (operand types are 'main()::__lambda1' and 'int') five.cpp:29: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 five.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: five.cpp:29:26: note: 'main()::__lambda1' is not derived from 'const std::reverse_iterator<_Iterator>' sol+=v[3]*v[1]*v([1]-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 five.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: five.cpp:29:26: note: 'main()::__lambda1' is not derived from 'const std::reverse_iterator<_Iterator>' sol+=v[3]*v[1]*v([1]-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 five.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: five.cpp:29:26: note: 'main()::__lambda1' is not derived from 'const std::move_iterator<_Iterator>' sol+=v[3]*v[1]*v([1]-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 five.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: five.cpp:29:26: note: 'main()::__lambda1' is not derived from 'const std::move_iterator<_Iterator>' sol+=v[3]*v[1]*v([1]-1)/2; ^ five.cpp:29:27: error: 'v' cannot be used as a function sol+=v[3]*v[1]*v([1]-1)/2; ^ five.cpp:30:24: error: expected identifier before numeric constant sol+=v[2]*v[24]*v([4]-1)/2; ^ five.cpp: In lambda function: five.cpp:30:26: error: expected '{' before '-' token sol+=v[2]*v[24]*v([4]-1)/2; ^ five.cpp: In function 'int main()': five.cpp:30:26: error: no match for 'operator-' (operand types are 'main()::__lambda2' and 'int') five.cpp:30:26: 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 five.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: five.cpp:30:27: note: 'main()::__lambda2' is not derived from 'const std::reverse_iterator<_Iterator>' sol+=v[2]*v[24]*v([4]-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 five.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: five.cpp:30:27: note: 'main()::__lambda2' is not derived from 'const std::reverse_iterator<_Iterator>' sol+=v[2]*v[24]*v([4]-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 five.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: five.cpp:30:27: note: 'main()::__lambda2' is not derived from 'const std::move_iterator<_Iterator>' sol+=v[2]*v[24]*v([4]-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 five.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: five.cpp:30:27: note: 'main()::__lambda2' is not derived from 'const std::move_iterator<_Iterator>' sol+=v[2]*v[24]*v([4]-1)/2; ^ five.cpp:30:28: error: 'v' cannot be used as a function sol+=v[2]*v[24]*v([4]-1)/2; ^ five.cpp:31:23: error: expected identifier before numeric constant sol+=v[3]+v[3]*v([3]-1)/2; ^ five.cpp: In lambda function: five.cpp:31:25: error: expected '{' before '-' token sol+=v[3]+v[3]*v([3]-1)/2; ^ five.cpp: In function 'int main()': five.cpp:31:25: error: no match for 'operator-' (operand types are 'main()::__lambda3' and 'int') five.cpp:31: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 five.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: five.cpp:31:26: note: 'main()::__lambda3' is not derived from 'const std::reverse_iterator<_Iterator>' sol+=v[3]+v[3]*v([3]-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 five.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: five.cpp:31:26: note: 'main()::__lambda3' is not derived from 'const std::reverse_iterator<_Iterator>' sol+=v[3]+v[3]*v([3]-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 five.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: five.cpp:31:26: note: 'main()::__lambda3' is not derived from 'const std::move_iterator<_Iterator>' sol+=v[3]+v[3]*v([3]-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 five.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: five.cpp:31:26: note: 'main()::__lambda3' is not derived from 'const std::move_iterator<_Iterator>' sol+=v[3]+v[3]*v([3]-1)/2; ^ five.cpp:31:27: error: 'v' cannot be used as a function sol+=v[3]+v[3]*v([3]-1)/2; ^ five.cpp:35:5: error: expected ';' before 'return' return 0; ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema five 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ă.