#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 | #54471167 | Utilizator | |
Fișier | five.cpp | Dimensiune | 611 B |
Data încărcării | 29 Noiembrie 2024, 11:40 | Scor / rezultat | Eroare de compilare |
five.cpp: In function 'int main()': five.cpp:14:5: error: 'ULL' was not declared in this scope ULL n, w, x,y, z, a, i; ^ five.cpp:14:10: error: expected ';' before 'n' ULL n, w, x,y, z, a, i; ^ five.cpp:15:10: error: 'n' was not declared in this scope cin>>n>>w>>x>>y>>y>>z; ^ five.cpp:15:13: error: 'w' was not declared in this scope cin>>n>>w>>x>>y>>y>>z; ^ five.cpp:15:16: error: 'x' was not declared in this scope cin>>n>>w>>x>>y>>y>>z; ^ five.cpp:15:19: error: 'y' was not declared in this scope cin>>n>>w>>x>>y>>y>>z; ^ five.cpp:15:25: error: 'z' was not declared in this scope cin>>n>>w>>x>>y>>y>>z; ^ five.cpp:17:5: error: 'v' was not declared in this scope v[a%5]++; ^ five.cpp:17:7: error: 'a' was not declared in this scope v[a%5]++; ^ five.cpp:18:9: error: 'i' was not declared in this scope for(i=2;i<=n;i++) ^ five.cpp:23:5: error: 'sol' was not declared in this scope sol=v[0]*(v[0-1])*(v[0]-2)/6 ^ five.cpp:24:5: error: expected ';' before 'sol' sol+=v[0]*v[1]*v[4]; ^ five.cpp:26:23: error: expected identifier before numeric constant sol+=v[1]*v[2]*v([2]-1)/2; ^ five.cpp: In lambda function: five.cpp:26:25: error: expected '{' before '-' token sol+=v[1]*v[2]*v([2]-1)/2; ^ five.cpp: In function 'int main()': five.cpp:26:25: error: no match for 'operator-' (operand types are 'main()::__lambda0' and 'int') five.cpp:26: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:26: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:26: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:26: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:26:26: note: 'main()::__lambda0' is not derived from 'const std::move_iterator<_Iterator>' sol+=v[1]*v[2]*v([2]-1)/2; ^ five.cpp:27:23: error: expected identifier before numeric constant sol+=v[3]*v[1]*v([1]-1)/2; ^ five.cpp: In lambda function: five.cpp:27:25: error: expected '{' before '-' token sol+=v[3]*v[1]*v([1]-1)/2; ^ five.cpp: In function 'int main()': five.cpp:27:25: error: no match for 'operator-' (operand types are 'main()::__lambda1' and 'int') five.cpp:27: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:27: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:27: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:27: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:27:26: note: 'main()::__lambda1' is not derived from 'const std::move_iterator<_Iterator>' sol+=v[3]*v[1]*v([1]-1)/2; ^ five.cpp:28:24: error: expected identifier before numeric constant sol+=v[2]*v[24]*v([4]-1)/2; ^ five.cpp: In lambda function: five.cpp:28:26: error: expected '{' before '-' token sol+=v[2]*v[24]*v([4]-1)/2; ^ five.cpp: In function 'int main()': five.cpp:28:26: error: no match for 'operator-' (operand types are 'main()::__lambda2' and 'int') five.cpp:28: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:28: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:28: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:28: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:28:27: note: 'main()::__lambda2' is not derived from 'const std::move_iterator<_Iterator>' sol+=v[2]*v[24]*v([4]-1)/2; ^ five.cpp:29:23: error: expected identifier before numeric constant sol+=v[3]+v[3]*v([3]-1)/2; ^ five.cpp: In lambda function: five.cpp:29:25: error: expected '{' before '-' token sol+=v[3]+v[3]*v([3]-1)/2; ^ five.cpp: In function 'int main()': five.cpp:29:25: error: no match for 'operator-' (operand types are 'main()::__lambda3' 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()::__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:29: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:29: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:29:26: note: 'main()::__lambda3' is not derived from 'const std::move_iterator<_Iterator>' sol+=v[3]+v[3]*v([3]-1)/2; ^ five.cpp:33: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ă.