#3072
Scrieți un program care citește un număr natural nenul n și care determină și afișează trei numere naturale a, b și c, astfel încât a+b+c=n și produsul a*b*c este maximul dintre produsele oricăror trei numere naturale care adunate dau suma egală cu n.
| Problema | sumprodmax3 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64856173 | Utilizator | |
| Fișier | sumprodmax3.cpp | Dimensiune | 453 B |
| Data încărcării | 07 Iunie 2026, 17:25 | Scor/rezultat | 20 puncte |
In file included from /usr/include/c++/13/iostream:41, from sumprodmax3.cpp:1: In member function ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]’, inlined from ‘int main()’ at sumprodmax3.cpp:17:13: /usr/include/c++/13/ostream:204:25: warning: ‘ra’ may be used uninitialized [-Wmaybe-uninitialized] 204 | { return _M_insert(__n); } | ~~~~~~~~~^~~~~ sumprodmax3.cpp: In function ‘int main()’: sumprodmax3.cpp:7:38: note: ‘ra’ was declared here 7 | long long a, b, c, maxProd = -1, ra, rb, rc; | ^~ In member function ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]’, inlined from ‘int main()’ at sumprodmax3.cpp:17:26: /usr/include/c++/13/ostream:204:25: warning: ‘rb’ may be used uninitialized [-Wmaybe-uninitialized] 204 | { return _M_insert(__n); } | ~~~~~~~~~^~~~~ sumprodmax3.cpp: In function ‘int main()’: sumprodmax3.cpp:7:42: note: ‘rb’ was declared here 7 | long long a, b, c, maxProd = -1, ra, rb, rc; | ^~ In member function ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(long long int) [with _CharT = char; _Traits = std::char_traits<char>]’, inlined from ‘int main()’ at sumprodmax3.cpp:17:39: /usr/include/c++/13/ostream:204:25: warning: ‘rc’ may be used uninitialized [-Wmaybe-uninitialized] 204 | { return _M_insert(__n); } | ~~~~~~~~~^~~~~ sumprodmax3.cpp: In function ‘int main()’: sumprodmax3.cpp:7:46: note: ‘rc’ was declared here 7 | long long a, b, c, maxProd = -1, ra, rb, rc; | ^~
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.002 secunde | OK. | 20 | 20 | Exemplu | |
| 2 | Depășit | Limita de timp depășită | 20 | 0 | ||
| 3 | Depășit | Limita de timp depășită | 20 | 0 | ||
| 4 | Depășit | Limita de timp depășită | 20 | 0 | ||
| 5 | Depășit | Limita de timp depășită | 20 | 0 | ||
| Punctaj total | 20 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema sumprodmax3 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ă.