#3481
sort_div
Se dau n
numere naturale. Să se afișeze acestea în ordinea crescătoare a numărului de divizori ai fiecăruia, la același număr de divizori crescător după cifra de control, la aceeași cifră de control crescător după prima cifră, iar dacă și prima cifră este aceeași atunci numerele se vor afișa în ordinea crescătoare a valorii lor.
Problema | sort_div | Operații I/O |
sort_div.in /sort_div.out
|
---|---|---|---|
Limita timp | 0.02 secunde | Limita memorie |
Total: 1 MB
/
Stivă 1 MB
|
Id soluție | #54384738 | Utilizator | |
Fișier | sort_div.cpp | Dimensiune | 1.59 KB |
Data încărcării | 27 Noiembrie 2024, 10:35 | Scor / rezultat | Eroare de compilare |
sort_div.cpp:15:1: error: 'Numar' does not name a type Numar v[10001]; ^ sort_div.cpp: In function 'bool cmp(int, int)': sort_div.cpp:47:32: error: 'clacPrimaCifra' was not declared in this scope if(clacPrimaCifra(a) == calcPrimaCifra(b)){ ^ sort_div.cpp:51:36: error: 'clacPrimaCifra' was not declared in this scope return clacPrimaCifra(a) < calcPrimaCifra(b); ^ sort_div.cpp: In function 'int main()': sort_div.cpp:66:15: error: no match for 'operator<' (operand types are 'int' and 'std::pair<int, std::pair<int, std::pair<int, int> > >') for(i=0; i<v[n]; i++){ ^ sort_div.cpp:66:15: note: candidates are: In file included from /usr/include/c++/4.8/bits/stl_algobase.h:64: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/istream:38, from /usr/include/c++/4.8/fstream:38, from sort_div.cpp:1: /usr/include/c++/4.8/bits/stl_pair.h:220:5: note: template<class _T1, class _T2> constexpr bool std::operator<(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&) operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) ^ /usr/include/c++/4.8/bits/stl_pair.h:220:5: note: template argument deduction/substitution failed: sort_div.cpp:66:19: note: mismatched types 'const std::pair<_T1, _T2>' and 'int' for(i=0; i<v[n]; i++){ ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from sort_div.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:297:5: note: template<class _Iterator> bool 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:297:5: note: template argument deduction/substitution failed: sort_div.cpp:66:19: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' for(i=0; i<v[n]; i++){ ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from sort_div.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:347:5: note: template<class _IteratorL, class _IteratorR> bool 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:347:5: note: template argument deduction/substitution failed: sort_div.cpp:66:19: note: mismatched types 'const std::reverse_iterator<_Iterator>' and 'int' for(i=0; i<v[n]; i++){ ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from sort_div.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:1055:5: note: template<class _IteratorL, class _IteratorR> bool 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:1055:5: note: template argument deduction/substitution failed: sort_div.cpp:66:19: note: mismatched types 'const std::move_iterator<_Iterator>' and 'int' for(i=0; i<v[n]; i++){ ^ 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/istream:38, from /usr/include/c++/4.8/fstream:38, from sort_div.cpp:1: /usr/include/c++/4.8/bits/stl_iterator.h:1061:5: note: template<class _Iterator> bool 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:1061:5: note: template argument deduction/substitution failed: sort_div.cpp:66:19: note: mismatched types 'const std::move_iterator<_Iterator>' and 'int' for(i=0; i<v[n]; i++){ ^ In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from sort_div.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2569:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const std::basic_string<_CharT, _Traits, _Alloc>&, const std::basic_string<_CharT, _Traits, _Alloc>&) operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2569:5: note: template argument deduction/substitution failed: sort_div.cpp:66:19: note: mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int' for(i=0; i<v[n]; i++){ ^ In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from sort_div.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2581:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const std::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*) operator<(const basic_string<_CharT, _Traits, _Alloc>& __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2581:5: note: template argument deduction/substitution failed: sort_div.cpp:66:19: note: mismatched types 'const std::basic_string<_CharT, _Traits, _Alloc>' and 'int' for(i=0; i<v[n]; i++){ ^ In file included from /usr/include/c++/4.8/string:52:0, from /usr/include/c++/4.8/bits/locale_classes.h:40, from /usr/include/c++/4.8/bits/ios_base.h:41, from /usr/include/c++/4.8/ios:42, from /usr/include/c++/4.8/istream:38, from /usr/include/c++/4.8/fstream:38, from sort_div.cpp:1: /usr/include/c++/4.8/bits/basic_string.h:2593:5: note: template<class _CharT, class _Traits, class _Alloc> bool std::operator<(const _CharT*, const std::basic_string<_CharT, _Traits, _Alloc>&) operator<(const _CharT* __lhs, ^ /usr/include/c++/4.8/bits/basic_string.h:2593:5: note: template argument deduction/substitution failed: sort_div.cpp:66:19: note: mismatched types 'const _CharT*' and 'int' for(i=0; i<v[n]; i++){ ^ 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 sort_div.cpp:2: /usr/include/c++/4.8/bits/stl_vector.h:1421:5: note: template<class _Tp, class _Alloc> bool std::operator<(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&) operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) ^ /usr/include/c++/4.8/bits/stl_vector.h:1421:5: note: template argument deduction/substitution failed: sort_div.cpp:66:19: note: mismatched types 'const std::vector<_Tp, _Alloc>' and 'int' for(i=0; i<v[n]; i++){ ^ In file included from /usr/include/c++/4.8/tuple:39:0, from /usr/include/c++/4.8/functional:55, from /usr/include/c++/4.8/bits/stl_algo.h:66, from /usr/include/c++/4.8/algorithm:62, from sort_div.cpp:2: /usr/include/c++/4.8/array:238:5: note: template<class _Tp, unsigned int _Nm> bool std::operator<(const std::array<_Tp, _Nm>&, const std::array<_Tp, _Nm>&) operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b) ^ /usr/include/c++/4.8/array:238:5: note: template argument deduction/substitution failed: sort_div.cpp:66:19: note: mismatched types 'const std::array<_Tp, _Nm>' and 'int' for(i=0; i<v[n]; i++){ ^ In file included from /usr/include/c++/4.8/functional:55:0, from /usr/include/c++/4.8/bits/stl_algo.h:66, from /usr/include/c++/4.8/algorithm:62, from sort_div.cpp:2: /usr/include/c++/4.8/tuple:824:5: note: template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const std::tuple<_Elements ...>&, const std::tuple<_Elements ...>&) operator<(const tuple<_TElements...>& __t, ^ /usr/include/c++/4.8/tuple:824:5: note: template argument deduction/substitution failed: sort_div.cpp:66:19: note: mismatched types 'const std::tuple<_Elements ...>' and 'int' for(i=0; i<v[n]; i++){ ^ sort_div.cpp:67:14: error: 'numar' was not declared in this scope cin>>numar.first; ^ sort_div.cpp:77:15: error: 'numar' was not declared in this scope cout<<numar.first<<" "; ^ sort_div.cpp:62:12: warning: unused variable 'a' [-Wunused-variable] int i, a; ^ In file included from /usr/include/c++/4.8/algorithm:62:0, from sort_div.cpp:2: /usr/include/c++/4.8/bits/stl_algo.h: In instantiation of 'void std::__insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, std::pair<int, int> > >*; _Compare = bool (*)(int, int)]': /usr/include/c++/4.8/bits/stl_algo.h:2226:70: required from 'void std::__final_insertion_sort(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, std::pair<int, int> > >*; _Compare = bool (*)(int, int)]' /usr/include/c++/4.8/bits/stl_algo.h:5500:55: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = std::pair<int, std::pair<int, std::pair<int, int> > >*; _Compare = bool (*)(int, int)]' sort_div.cpp:74:25: required from here /usr/include/c++/4.8/bits/stl_algo.h:2159:29: error: cannot convert 'std::pair<int, std::pair<int, std::pair<int, int> > >' to 'int' in argument passing if (__comp(*__i, *__first)) ^ /usr/include/c++/4.8/bits/stl_algo.h: In instantiation of 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, std::pair<int, int> > >*; _Compare = bool (*)(int, int)]': /usr/include/c++/4.8/bits/stl_algo.h:5349:59: required from 'void std::partial_sort(_RAIter, _RAIter, _RAIter, _Compare) [with _RAIter = std::pair<int, std::pair<int, std::pair<int, int> > >*; _Compare = bool (*)(int, int)]' /usr/include/c++/4.8/bits/stl_algo.h:2332:68: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, std::pair<int, int> > >*; _Size = int; _Compare = bool (*)(int, int)]' /usr/include/c++/4.8/bits/stl_algo.h:5499:44: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = std::pair<int, std::pair<int, std::pair<int, int> > >*; _Compare = bool (*)(int, int)]' sort_div.cpp:74:25: required from here /usr/include/c++/4.8/bits/stl_algo.h:1948:27: error: cannot convert 'std::pair<int, std::pair<int, std::pair<int, int> > >' to 'int' in argument passing if (__comp(*__i, *__first)) ^ /usr/include/c++/4.8/bits/stl_algo.h: In instantiation of 'void std::__move_median_to_first(_Iterator, _Iterator, _Iterator, _Iterator, _Compare) [with _Iterator = std::pair<int, std::pair<int, std::pair<int, int> > >*; _Compare = bool (*)(int, int)]': /usr/include/c++/4.8/bits/stl_algo.h:2295:13: required from '_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, std::pair<int, int> > >*; _Compare = bool (*)(int, int)]' /usr/include/c++/4.8/bits/stl_algo.h:2337:62: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, std::pair<int, int> > >*; _Size = int; _Compare = bool (*)(int, int)]' /usr/include/c++/4.8/bits/stl_algo.h:5499:44: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = std::pair<int, std::pair<int, std::pair<int, int> > >*; _Compare = bool (*)(int, int)]' sort_div.cpp:74:25: required from here /usr/include/c++/4.8/bits/stl_algo.h:114:28: error: cannot convert 'std::pair<int, std::pair<int, std::pair<int, int> > >' to 'int' in argument passing if (__comp(*__a, *__b)) ^ /usr/include/c++/4.8/bits/stl_algo.h:116:25: error: cannot convert 'std::pair<int, std::pair<int, std::pair<int, int> > >' to 'int' in argument passing if (__comp(*__b, *__c)) ^ /usr/include/c++/4.8/bits/stl_algo.h:118:30: error: cannot convert 'std::pair<int, std::pair<int, std::pair<int, int> > >' to 'int' in argument passing else if (__comp(*__a, *__c)) ^ /usr/include/c++/4.8/bits/stl_algo.h:123:33: error: cannot convert 'std::pair<int, std::pair<int, std::pair<int, int> > >' to 'int' in argument passing else if (__comp(*__a, *__c)) ^ /usr/include/c++/4.8/bits/stl_algo.h:125:33: error: cannot convert 'std::pair<int, std::pair<int, std::pair<int, int> > >' to 'int' in argument passing else if (__comp(*__b, *__c)) ^ /usr/include/c++/4.8/bits/stl_algo.h: In instantiation of '_RandomAccessIterator std::__unguarded_partition(_RandomAccessIterator, _RandomAccessIterator, const _Tp&, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, std::pair<int, int> > >*; _Tp = std::pair<int, std::pair<int, std::pair<int, int> > >; _Compare = bool (*)(int, int)]': /usr/include/c++/4.8/bits/stl_algo.h:2296:78: required from '_RandomAccessIterator std::__unguarded_partition_pivot(_RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, std::pair<int, int> > >*; _Compare = bool (*)(int, int)]' /usr/include/c++/4.8/bits/stl_algo.h:2337:62: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, std::pair<int, int> > >*; _Size = int; _Compare = bool (*)(int, int)]' /usr/include/c++/4.8/bits/stl_algo.h:5499:44: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = std::pair<int, std::pair<int, std::pair<int, int> > >*; _Compare = bool (*)(int, int)]' sort_div.cpp:74:25: required from here /usr/include/c++/4.8/bits/stl_algo.h:2263:35: error: cannot convert 'std::pair<int, std::pair<int, std::pair<int, int> > >' to 'int' in argument passing while (__comp(*__first, __pivot)) ^ /usr/include/c++/4.8/bits/stl_algo.h:2266:34: error: cannot convert 'const std::pair<int, std::pair<int, std::pair<int, int> > >' to 'int' in argument passing while (__comp(__pivot, *__last)) ^ In file included from /usr/include/c++/4.8/bits/stl_algo.h:61:0, from /usr/include/c++/4.8/algorithm:62, from sort_div.cpp:2: /usr/include/c++/4.8/bits/stl_heap.h: In instantiation of 'void std::__adjust_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, std::pair<int, int> > >*; _Distance = int; _Tp = std::pair<int, std::pair<int, std::pair<int, int> > >; _Compare = bool (*)(int, int)]': /usr/include/c++/4.8/bits/stl_heap.h:448:15: required from 'void std::make_heap(_RAIter, _RAIter, _Compare) [with _RAIter = std::pair<int, std::pair<int, std::pair<int, int> > >*; _Compare = bool (*)(int, int)]' /usr/include/c++/4.8/bits/stl_algo.h:1946:47: required from 'void std::__heap_select(_RandomAccessIterator, _RandomAccessIterator, _RandomAccessIterator, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, std::pair<int, int> > >*; _Compare = bool (*)(int, int)]' /usr/include/c++/4.8/bits/stl_algo.h:5349:59: required from 'void std::partial_sort(_RAIter, _RAIter, _RAIter, _Compare) [with _RAIter = std::pair<int, std::pair<int, std::pair<int, int> > >*; _Compare = bool (*)(int, int)]' /usr/include/c++/4.8/bits/stl_algo.h:2332:68: required from 'void std::__introsort_loop(_RandomAccessIterator, _RandomAccessIterator, _Size, _Compare) [with _RandomAccessIterator = std::pair<int, std::pair<int, std::pair<int, int> > >*; _Size = int; _Compare = bool (*)(int, int)]' /usr/include/c++/4.8/bits/stl_algo.h:5499:44: required from 'void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = std::pair<int, std::pair<int, std::pair<int, int> > >*; _Compare = bool (*)(int, int)]' sort_div.cpp:74:25: required from here /usr/include/c++/4.8/bits/stl_heap.h:313:40: error: cannot convert 'std::pair<int, std::pair<int, std::pair<int, int> > >' to 'int' in argument passing *(__first + (__secondChild - 1)))) ^
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema sort_div 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ă.