#4487
Se consideră un cerc. Pe cerc se desemnează N puncte oarecare. Dacă tragem linii între toate perechile de puncte, care este numărul maxim de bucăți în care poate fi descompus cercul? Să se răspundă la Q astfel de scenarii.
| Problema | moser | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.2 secunde | Limita memorie |
Total: 128 MB
/
Stivă 8 MB
|
| Id soluție | #64754381 | Utilizator | |
| Fișier | moser.cpp | Dimensiune | 453 B |
| Data încărcării | 28 Mai 2026, 00:52 | Scor/rezultat | Eroare de compilare |
moser.cpp: In function ‘int main()’: moser.cpp:12:14: warning: capture of variable ‘n’ with non-automatic storage duration 12 | s = [n*(n-1)]/2+1; | ^ moser.cpp:3:19: note: ‘int n’ declared here 3 | int N[100001], Q, n, s; | ^ moser.cpp:12:15: error: expected ‘,’ before ‘*’ token 12 | s = [n*(n-1)]/2+1; | ^ | , moser.cpp:12:15: error: expected identifier before ‘*’ token moser.cpp: In lambda function: moser.cpp:12:22: error: expected ‘{’ before ‘/’ token 12 | s = [n*(n-1)]/2+1; | ^ moser.cpp: In function ‘int main()’: moser.cpp:12:22: error: no match for ‘operator/’ (operand types are ‘main()::<lambda()>’ and ‘int’) 12 | s = [n*(n-1)]/2+1; | ~~~~~~~~~^~ | | | | | int | main()::<lambda()> In file included from /usr/include/c++/13/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:127, from moser.cpp:1: /usr/include/c++/13/complex:425:5: note: candidate: ‘template<class _Tp> std::complex<_Tp> std::operator/(const complex<_Tp>&, const complex<_Tp>&)’ 425 | operator/(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/13/complex:425:5: note: template argument deduction/substitution failed: moser.cpp:12:23: note: ‘main()::<lambda()>’ is not derived from ‘const std::complex<_Tp>’ 12 | s = [n*(n-1)]/2+1; | ^ /usr/include/c++/13/complex:434:5: note: candidate: ‘template<class _Tp> std::complex<_Tp> std::operator/(const complex<_Tp>&, const _Tp&)’ 434 | operator/(const complex<_Tp>& __x, const _Tp& __y) | ^~~~~~~~ /usr/include/c++/13/complex:434:5: note: template argument deduction/substitution failed: moser.cpp:12:23: note: ‘main()::<lambda()>’ is not derived from ‘const std::complex<_Tp>’ 12 | s = [n*(n-1)]/2+1; | ^ /usr/include/c++/13/complex:443:5: note: candidate: ‘template<class _Tp> std::complex<_Tp> std::operator/(const _Tp&, const complex<_Tp>&)’ 443 | operator/(const _Tp& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/13/complex:443:5: note: template argument deduction/substitution failed: moser.cpp:12:23: note: mismatched types ‘const std::complex<_Tp>’ and ‘int’ 12 | s = [n*(n-1)]/2+1; | ^ In file included from /usr/include/c++/13/valarray:605, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:166: /usr/include/c++/13/bits/valarray_after.h:408:5: note: candidate: ‘template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__divides, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__divides, typename _Dom1::value_type>::result_type> std::operator/(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)’ 408 | _DEFINE_EXPR_BINARY_OPERATOR(/, struct std::__divides) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/valarray_after.h:408:5: note: template argument deduction/substitution failed: moser.cpp:12:23: note: ‘main()::<lambda()>’ is not derived from ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’ 12 | s = [n*(n-1)]/2+1; | ^ /usr/include/c++/13/bits/valarray_after.h:408:5: note: candidate: ‘template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__divides, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__divides, typename _Dom1::value_type>::result_type> std::operator/(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)’ 408 | _DEFINE_EXPR_BINARY_OPERATOR(/, struct std::__divides) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/valarray_after.h:408:5: note: template argument deduction/substitution failed: moser.cpp:12:23: note: ‘main()::<lambda()>’ is not derived from ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’ 12 | s = [n*(n-1)]/2+1; | ^ /usr/include/c++/13/bits/valarray_after.h:408:5: note: candidate: ‘template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__divides, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__divides, typename _Dom1::value_type>::result_type> std::operator/(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)’ 408 | _DEFINE_EXPR_BINARY_OPERATOR(/, struct std::__divides) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/valarray_after.h:408:5: note: template argument deduction/substitution failed: moser.cpp:12:23: note: mismatched types ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’ and ‘int’ 12 | s = [n*(n-1)]/2+1; | ^ /usr/include/c++/13/bits/valarray_after.h:408:5: note: candidate: ‘template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__divides, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__divides, typename _Dom1::value_type>::result_type> std::operator/(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)’ 408 | _DEFINE_EXPR_BINARY_OPERATOR(/, struct std::__divides) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/valarray_after.h:408:5: note: template argument deduction/substitution failed: moser.cpp:12:23: note: ‘main()::<lambda()>’ is not derived from ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’ 12 | s = [n*(n-1)]/2+1; | ^ /usr/include/c++/13/bits/valarray_after.h:408:5: note: candidate: ‘template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__divides, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__divides, typename _Dom1::value_type>::result_type> std::operator/(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)’ 408 | _DEFINE_EXPR_BINARY_OPERATOR(/, struct std::__divides) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/valarray_after.h:408:5: note: template argument deduction/substitution failed: moser.cpp:12:23: note: mismatched types ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’ and ‘int’ 12 | s = [n*(n-1)]/2+1; | ^ /usr/include/c++/13/valarray:1199:1: note: candidate: ‘template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__divides, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__divides, _Tp>::result_type> std::operator/(const valarray<_Tp>&, const valarray<_Tp>&)’ 1199 | _DEFINE_BINARY_OPERATOR(/, __divides) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/valarray:1199:1: note: template argument deduction/substitution failed: moser.cpp:12:23: note: ‘main()::<lambda()>’ is not derived from ‘const std::valarray<_Tp>’ 12 | s = [n*(n-1)]/2+1; | ^ /usr/include/c++/13/valarray:1199:1: note: candidate: ‘template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__divides, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__divides, _Tp>::result_type> std::operator/(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)’ 1199 | _DEFINE_BINARY_OPERATOR(/, __divides) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/valarray:1199:1: note: template argument deduction/substitution failed: moser.cpp:12:23: note: ‘main()::<lambda()>’ is not derived from ‘const std::valarray<_Tp>’ 12 | s = [n*(n-1)]/2+1; | ^ /usr/include/c++/13/valarray:1199:1: note: candidate: ‘template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__divides, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__divides, _Tp>::result_type> std::operator/(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)’ 1199 | _DEFINE_BINARY_OPERATOR(/, __divides) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/valarray:1199:1: note: template argument deduction/substitution failed: moser.cpp:12:23: note: mismatched types ‘const std::valarray<_Tp>’ and ‘int’ 12 | s = [n*(n-1)]/2+1; | ^ moser.cpp:16:26: warning: capture of variable ‘n’ with non-automatic storage duration 16 | else N[i] = s + [n*(n-1)*(n-2)*(n-3)]/24; | ^ moser.cpp:3:19: note: ‘int n’ declared here 3 | int N[100001], Q, n, s; | ^ moser.cpp:16:27: error: expected ‘,’ before ‘*’ token 16 | else N[i] = s + [n*(n-1)*(n-2)*(n-3)]/24; | ^ | , moser.cpp:16:27: error: expected identifier before ‘*’ token moser.cpp: In lambda function: moser.cpp:16:46: error: expected ‘{’ before ‘/’ token 16 | else N[i] = s + [n*(n-1)*(n-2)*(n-3)]/24; | ^ moser.cpp: In function ‘int main()’: moser.cpp:16:46: error: no match for ‘operator/’ (operand types are ‘main()::<lambda()>’ and ‘int’) 16 | else N[i] = s + [n*(n-1)*(n-2)*(n-3)]/24; | ~~~~~~~~~~~~~~~~~~~~~^~~ | | | | main()::<lambda()> int /usr/include/c++/13/complex:425:5: note: candidate: ‘template<class _Tp> std::complex<_Tp> std::operator/(const complex<_Tp>&, const complex<_Tp>&)’ 425 | operator/(const complex<_Tp>& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/13/complex:425:5: note: template argument deduction/substitution failed: moser.cpp:16:47: note: ‘main()::<lambda()>’ is not derived from ‘const std::complex<_Tp>’ 16 | else N[i] = s + [n*(n-1)*(n-2)*(n-3)]/24; | ^~ /usr/include/c++/13/complex:434:5: note: candidate: ‘template<class _Tp> std::complex<_Tp> std::operator/(const complex<_Tp>&, const _Tp&)’ 434 | operator/(const complex<_Tp>& __x, const _Tp& __y) | ^~~~~~~~ /usr/include/c++/13/complex:434:5: note: template argument deduction/substitution failed: moser.cpp:16:47: note: ‘main()::<lambda()>’ is not derived from ‘const std::complex<_Tp>’ 16 | else N[i] = s + [n*(n-1)*(n-2)*(n-3)]/24; | ^~ /usr/include/c++/13/complex:443:5: note: candidate: ‘template<class _Tp> std::complex<_Tp> std::operator/(const _Tp&, const complex<_Tp>&)’ 443 | operator/(const _Tp& __x, const complex<_Tp>& __y) | ^~~~~~~~ /usr/include/c++/13/complex:443:5: note: template argument deduction/substitution failed: moser.cpp:16:47: note: mismatched types ‘const std::complex<_Tp>’ and ‘int’ 16 | else N[i] = s + [n*(n-1)*(n-2)*(n-3)]/24; | ^~ /usr/include/c++/13/bits/valarray_after.h:408:5: note: candidate: ‘template<class _Dom1, class _Dom2> std::_Expr<std::__detail::_BinClos<std::__divides, std::_Expr, std::_Expr, _Dom1, _Dom2>, typename std::__fun<std::__divides, typename _Dom1::value_type>::result_type> std::operator/(const _Expr<_Dom1, typename _Dom1::value_type>&, const _Expr<_Dom2, typename _Dom2::value_type>&)’ 408 | _DEFINE_EXPR_BINARY_OPERATOR(/, struct std::__divides) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/valarray_after.h:408:5: note: template argument deduction/substitution failed: moser.cpp:16:47: note: ‘main()::<lambda()>’ is not derived from ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’ 16 | else N[i] = s + [n*(n-1)*(n-2)*(n-3)]/24; | ^~ /usr/include/c++/13/bits/valarray_after.h:408:5: note: candidate: ‘template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__divides, std::_Expr, std::_Constant, _Dom, typename _Dom::value_type>, typename std::__fun<std::__divides, typename _Dom1::value_type>::result_type> std::operator/(const _Expr<_Dom1, typename _Dom1::value_type>&, const typename _Dom::value_type&)’ 408 | _DEFINE_EXPR_BINARY_OPERATOR(/, struct std::__divides) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/valarray_after.h:408:5: note: template argument deduction/substitution failed: moser.cpp:16:47: note: ‘main()::<lambda()>’ is not derived from ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’ 16 | else N[i] = s + [n*(n-1)*(n-2)*(n-3)]/24; | ^~ /usr/include/c++/13/bits/valarray_after.h:408:5: note: candidate: ‘template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__divides, std::_Constant, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__divides, typename _Dom1::value_type>::result_type> std::operator/(const typename _Dom::value_type&, const _Expr<_Dom1, typename _Dom1::value_type>&)’ 408 | _DEFINE_EXPR_BINARY_OPERATOR(/, struct std::__divides) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/valarray_after.h:408:5: note: template argument deduction/substitution failed: moser.cpp:16:47: note: mismatched types ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’ and ‘int’ 16 | else N[i] = s + [n*(n-1)*(n-2)*(n-3)]/24; | ^~ /usr/include/c++/13/bits/valarray_after.h:408:5: note: candidate: ‘template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__divides, std::_Expr, std::_ValArray, _Dom, typename _Dom::value_type>, typename std::__fun<std::__divides, typename _Dom1::value_type>::result_type> std::operator/(const _Expr<_Dom1, typename _Dom1::value_type>&, const valarray<typename _Dom::value_type>&)’ 408 | _DEFINE_EXPR_BINARY_OPERATOR(/, struct std::__divides) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/valarray_after.h:408:5: note: template argument deduction/substitution failed: moser.cpp:16:47: note: ‘main()::<lambda()>’ is not derived from ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’ 16 | else N[i] = s + [n*(n-1)*(n-2)*(n-3)]/24; | ^~ /usr/include/c++/13/bits/valarray_after.h:408:5: note: candidate: ‘template<class _Dom> std::_Expr<std::__detail::_BinClos<std::__divides, std::_ValArray, std::_Expr, typename _Dom::value_type, _Dom>, typename std::__fun<std::__divides, typename _Dom1::value_type>::result_type> std::operator/(const valarray<typename _Dom::value_type>&, const _Expr<_Dom1, typename _Dom1::value_type>&)’ 408 | _DEFINE_EXPR_BINARY_OPERATOR(/, struct std::__divides) | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/bits/valarray_after.h:408:5: note: template argument deduction/substitution failed: moser.cpp:16:47: note: mismatched types ‘const std::_Expr<_Dom1, typename _Dom1::value_type>’ and ‘int’ 16 | else N[i] = s + [n*(n-1)*(n-2)*(n-3)]/24; | ^~ /usr/include/c++/13/valarray:1199:1: note: candidate: ‘template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__divides, std::_ValArray, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__divides, _Tp>::result_type> std::operator/(const valarray<_Tp>&, const valarray<_Tp>&)’ 1199 | _DEFINE_BINARY_OPERATOR(/, __divides) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/valarray:1199:1: note: template argument deduction/substitution failed: moser.cpp:16:47: note: ‘main()::<lambda()>’ is not derived from ‘const std::valarray<_Tp>’ 16 | else N[i] = s + [n*(n-1)*(n-2)*(n-3)]/24; | ^~ /usr/include/c++/13/valarray:1199:1: note: candidate: ‘template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__divides, std::_ValArray, std::_Constant, _Tp, _Tp>, typename std::__fun<std::__divides, _Tp>::result_type> std::operator/(const valarray<_Tp>&, const typename valarray<_Tp>::value_type&)’ 1199 | _DEFINE_BINARY_OPERATOR(/, __divides) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/valarray:1199:1: note: template argument deduction/substitution failed: moser.cpp:16:47: note: ‘main()::<lambda()>’ is not derived from ‘const std::valarray<_Tp>’ 16 | else N[i] = s + [n*(n-1)*(n-2)*(n-3)]/24; | ^~ /usr/include/c++/13/valarray:1199:1: note: candidate: ‘template<class _Tp> std::_Expr<std::__detail::_BinClos<std::__divides, std::_Constant, std::_ValArray, _Tp, _Tp>, typename std::__fun<std::__divides, _Tp>::result_type> std::operator/(const typename valarray<_Tp>::value_type&, const valarray<_Tp>&)’ 1199 | _DEFINE_BINARY_OPERATOR(/, __divides) | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/13/valarray:1199:1: note: template argument deduction/substitution failed: moser.cpp:16:47: note: mismatched types ‘const std::valarray<_Tp>’ and ‘int’ 16 | else N[i] = s + [n*(n-1)*(n-2)*(n-3)]/24; | ^~ moser.cpp:18:41: error: ‘i’ was not declared in this scope 18 | for(int j = 1; j<=Q; j++) cout << N[i] << endl; | ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema moser 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ă.