#4463
pcp
Se consideră un număr natural nenul N
. Să se determine toate pătratele perfecte distincte care se obțin prin permutarea cifrelor numărului N
.
Lot informatică 2023
Problema | pcp | Operații I/O |
pcp.in /pcp.out
|
---|---|---|---|
Limita timp | 0.8 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
Id soluție | #53265972 | Utilizator | |
Fișier | pcp.cpp | Dimensiune | 946 B |
Data încărcării | 22 Octombrie 2024, 20:26 | Scor / rezultat | Eroare de compilare |
pcp.cpp: In function 'int64_t buildNumber()': pcp.cpp:12:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(int i = 0; i < v.size(); i++) ^ pcp.cpp: In function 'int main()': pcp.cpp:22:57: error: no matching function for call to 'std::vector<long long int>::insert(int64_t&)' t = buildNumber(); if(isPerfectSquare(t)) s.insert(t); ^ pcp.cpp:22:57: note: candidates are: In file included from /usr/include/c++/4.8/vector:69: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 pcp.cpp:2: /usr/include/c++/4.8/bits/vector.tcc:107:5: note: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::iterator, const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = long long int*; std::vector<_Tp, _Alloc>::value_type = long long int] vector<_Tp, _Alloc>:: ^ /usr/include/c++/4.8/bits/vector.tcc:107:5: note: candidate expects 2 arguments, 1 provided In file included from /usr/include/c++/4.8/vector:64: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 pcp.cpp:2: /usr/include/c++/4.8/bits/stl_vector.h:988:7: note: std::vector<_Tp, _Alloc>::iterator std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::iterator, std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = long long int*; std::vector<_Tp, _Alloc>::value_type = long long int] insert(iterator __position, value_type&& __x) ^ /usr/include/c++/4.8/bits/stl_vector.h:988:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/4.8/bits/stl_vector.h:1005:7: note: void std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::iterator, std::initializer_list<_Tp>) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = long long int*] insert(iterator __position, initializer_list<value_type> __l) ^ /usr/include/c++/4.8/bits/stl_vector.h:1005:7: note: candidate expects 2 arguments, 1 provided /usr/include/c++/4.8/bits/stl_vector.h:1023:7: note: void std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::iterator, std::vector<_Tp, _Alloc>::size_type, const value_type&) [with _Tp = long long int; _Alloc = std::allocator<long long int>; std::vector<_Tp, _Alloc>::iterator = __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >; typename std::_Vector_base<_Tp, _Alloc>::pointer = long long int*; std::vector<_Tp, _Alloc>::size_type = unsigned int; std::vector<_Tp, _Alloc>::value_type = long long int] insert(iterator __position, size_type __n, const value_type& __x) ^ /usr/include/c++/4.8/bits/stl_vector.h:1023:7: note: candidate expects 3 arguments, 1 provided /usr/include/c++/4.8/bits/stl_vector.h:1044:9: note: template<class _InputIterator, class> void std::vector<_Tp, _Alloc>::insert(std::vector<_Tp, _Alloc>::iterator, _InputIterator, _InputIterator) [with _InputIterator = _InputIterator; <template-parameter-2-2> = <template-parameter-1-2>; _Tp = long long int; _Alloc = std::allocator<long long int>] insert(iterator __position, _InputIterator __first, ^ /usr/include/c++/4.8/bits/stl_vector.h:1044:9: note: template argument deduction/substitution failed: pcp.cpp:22:57: note: cannot convert 't' (type 'int64_t {aka long long int}') to type 'std::vector<long long int>::iterator {aka __gnu_cxx::__normal_iterator<long long int*, std::vector<long long int> >}' t = buildNumber(); if(isPerfectSquare(t)) s.insert(t); ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema pcp 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ă.