#3481
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 | #64167364 | Utilizator | |
| Fișier | sort_div.cpp | Dimensiune | 1.03 KB |
| Data încărcării | 21 Aprilie 2026, 11:57 | Scor/rezultat | Eroare de compilare |
sort_div.cpp: In function ‘int Div(nr)’: sort_div.cpp:14:26: error: no match for ‘operator<=’ (operand types are ‘int’ and ‘nr’) 14 | for(int b = 1; b * b <= a; b++) | ~~~~~ ^~ ~ | | | | int nr In file included from /usr/include/c++/13/string:48, from /usr/include/c++/13/bits/locale_classes.h:40, from /usr/include/c++/13/bits/ios_base.h:41, from /usr/include/c++/13/ios:44, from /usr/include/c++/13/istream:40, from /usr/include/c++/13/fstream:40, from sort_div.cpp:1: /usr/include/c++/13/bits/stl_iterator.h:476:5: note: candidate: ‘template<class _Iterator> bool std::operator<=(const reverse_iterator<_Iterator>&, const reverse_iterator<_Iterator>&)’ 476 | operator<=(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:476:5: note: template argument deduction/substitution failed: sort_div.cpp:14:29: note: mismatched types ‘const std::reverse_iterator<_Iterator>’ and ‘int’ 14 | for(int b = 1; b * b <= a; b++) | ^ /usr/include/c++/13/bits/stl_iterator.h:520:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> bool std::operator<=(const reverse_iterator<_Iterator>&, const reverse_iterator<_IteratorR>&)’ 520 | operator<=(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:520:5: note: template argument deduction/substitution failed: sort_div.cpp:14:29: note: mismatched types ‘const std::reverse_iterator<_Iterator>’ and ‘int’ 14 | for(int b = 1; b * b <= a; b++) | ^ /usr/include/c++/13/bits/stl_iterator.h:1715:5: note: candidate: ‘template<class _IteratorL, class _IteratorR> bool std::operator<=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)’ 1715 | operator<=(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:1715:5: note: template argument deduction/substitution failed: sort_div.cpp:14:29: note: mismatched types ‘const std::move_iterator<_IteratorL>’ and ‘int’ 14 | for(int b = 1; b * b <= a; b++) | ^ /usr/include/c++/13/bits/stl_iterator.h:1777:5: note: candidate: ‘template<class _Iterator> bool std::operator<=(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)’ 1777 | operator<=(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/13/bits/stl_iterator.h:1777:5: note: template argument deduction/substitution failed: sort_div.cpp:14:29: note: mismatched types ‘const std::move_iterator<_IteratorL>’ and ‘int’ 14 | for(int b = 1; b * b <= a; b++) | ^ In file included from /usr/include/c++/13/bits/stl_algobase.h:64, from /usr/include/c++/13/string:51: /usr/include/c++/13/bits/stl_pair.h:854:5: note: candidate: ‘template<class _T1, class _T2> constexpr bool std::operator<=(const pair<_T1, _T2>&, const pair<_T1, _T2>&)’ 854 | operator<=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/13/bits/stl_pair.h:854:5: note: template argument deduction/substitution failed: sort_div.cpp:14:29: note: mismatched types ‘const std::pair<_T1, _T2>’ and ‘int’ 14 | for(int b = 1; b * b <= a; b++) | ^ In file included from /usr/include/c++/13/string:54: /usr/include/c++/13/bits/basic_string.h:3911:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’ 3911 | operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3911:5: note: template argument deduction/substitution failed: sort_div.cpp:14:29: note: mismatched types ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘int’ 14 | for(int b = 1; b * b <= a; b++) | ^ /usr/include/c++/13/bits/basic_string.h:3925:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const __cxx11::basic_string<_CharT, _Traits, _Alloc>&, const _CharT*)’ 3925 | operator<=(const basic_string<_CharT, _Traits, _Alloc>& __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3925:5: note: template argument deduction/substitution failed: sort_div.cpp:14:29: note: mismatched types ‘const std::__cxx11::basic_string<_CharT, _Traits, _Alloc>’ and ‘int’ 14 | for(int b = 1; b * b <= a; b++) | ^ /usr/include/c++/13/bits/basic_string.h:3938:5: note: candidate: ‘template<class _CharT, class _Traits, class _Alloc> bool std::operator<=(const _CharT*, const __cxx11::basic_string<_CharT, _Traits, _Alloc>&)’ 3938 | operator<=(const _CharT* __lhs, | ^~~~~~~~ /usr/include/c++/13/bits/basic_string.h:3938:5: note: template argument deduction/substitution failed: sort_div.cpp:14:29: note: mismatched types ‘const _CharT*’ and ‘int’ 14 | for(int b = 1; b * b <= a; b++) | ^ sort_div.cpp:15:14: error: no match for ‘operator%’ (operand types are ‘nr’ and ‘int’) 15 | if(a % b == 0) | ~ ^ ~ | | | | nr int sort_div.cpp:18:13: error: ‘p’ was not declared in this scope 18 | p = a / b; | ^ sort_div.cpp:18:19: error: no match for ‘operator/’ (operand types are ‘nr’ and ‘int’) 18 | p = a / b; | ~ ^ ~ | | | | nr int sort_div.cpp: In function ‘int Sum(nr)’: sort_div.cpp:30:11: error: could not convert ‘a’ from ‘nr’ to ‘bool’ 30 | while(a) | ^ | | | nr sort_div.cpp:32:18: error: no match for ‘operator%’ (operand types are ‘nr’ and ‘int’) 32 | cif += a % 10; | ~ ^ ~~ | | | | nr int sort_div.cpp:33:11: error: no match for ‘operator/=’ (operand types are ‘nr’ and ‘int’) 33 | a /= 10; | ~~^~~~~ sort_div.cpp: In function ‘bool Cmp(nr, nr)’: sort_div.cpp:55:37: error: could not convert ‘a.nr::d’ from ‘int’ to ‘nr’ 55 | else if(a.div == b.div && Sum(a.d) > Sum(b.d)) | ~~^ | | | int sort_div.cpp:55:48: error: could not convert ‘b.nr::d’ from ‘int’ to ‘nr’ 55 | else if(a.div == b.div && Sum(a.d) > Sum(b.d)) | ~~^ | | | int sort_div.cpp:58:16: error: ‘o’ was not declared in this scope 58 | return o | ^ sort_div.cpp:58:17: error: expected ‘;’ before ‘}’ token 58 | return o | ^ | ; 59 | } | ~ sort_div.cpp: In function ‘int main()’: sort_div.cpp:62:5: error: ‘cin’ was not declared in this scope 62 | cin >> n; | ^~~ sort_div.cpp:4:1: note: ‘std::cin’ is defined in header ‘<iostream>’; did you forget to ‘#include <iostream>’? 3 | #include <cmath> +++ |+#include <iostream> 4 | using namespace std; sort_div.cpp:62:12: error: ‘n’ was not declared in this scope; did you mean ‘yn’? 62 | cin >> n; | ^ | yn sort_div.cpp:67:29: error: could not convert ‘a[i].nr::d’ from ‘int’ to ‘nr’ 67 | a[i].div = Div(a[i].d); | ~~~~~^ | | | int
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ă.