#4317
Să se scrie un program care citește un număr natural n cu cifrele distincte și schimbă între ele cea mai mare și cea mai mică cifră a lui n.
| Problema | Cifre19 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64838042 | Utilizator | |
| Fișier | cifre19.cpp | Dimensiune | 654 B |
| Data încărcării | 05 Iunie 2026, 11:38 | Scor/rezultat | 100 puncte |
cifre19.cpp: In function ‘int main()’: cifre19.cpp:18:18: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::deque<int>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare] 18 | for(int i=0;i<number.size();i++){ | ~^~~~~~~~~~~~~~ In file included from /usr/include/c++/13/deque:66, from cifre19.cpp:2: In member function ‘std::deque<_Tp, _Alloc>::reference std::deque<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>]’, inlined from ‘int main()’ at cifre19.cpp:28:20: /usr/include/c++/13/bits/stl_deque.h:1367:38: warning: ‘pos’ may be used uninitialized [-Wmaybe-uninitialized] 1367 | return this->_M_impl._M_start[difference_type(__n)]; | ~~~~~~~~~~~~~~~~~~~~~~^ cifre19.cpp: In function ‘int main()’: cifre19.cpp:16:9: note: ‘pos’ was declared here 16 | int pos; | ^~~ In member function ‘std::deque<_Tp, _Alloc>::reference std::deque<_Tp, _Alloc>::operator[](size_type) [with _Tp = int; _Alloc = std::allocator<int>]’, inlined from ‘int main()’ at cifre19.cpp:28:33: /usr/include/c++/13/bits/stl_deque.h:1367:38: warning: ‘pos2’ may be used uninitialized [-Wmaybe-uninitialized] 1367 | return this->_M_impl._M_start[difference_type(__n)]; | ~~~~~~~~~~~~~~~~~~~~~~^ cifre19.cpp: In function ‘int main()’: cifre19.cpp:17:9: note: ‘pos2’ was declared here 17 | int pos2; | ^~~~
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.001 secunde | OK. | 20 | 20 | Exemplu | |
| 2 | 0.001 secunde | OK. | 20 | 20 | ||
| 3 | 0.001 secunde | OK. | 20 | 20 | ||
| 4 | 0.002 secunde | OK. | 20 | 20 | ||
| 5 | 0.002 secunde | OK. | 20 | 20 | ||
| Punctaj total | 100 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema Cifre19 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ă.