#3980
Se citește un număr natural nenul n și apoi se citesc n numere naturale. Calculați suma dintre valoarea minimă și valoarea maximă.
| Problema | MinPlusMax | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64572400 | Utilizator | |
| Fișier | minplusmax.cpp | Dimensiune | 223 B |
| Data încărcării | 15 Mai 2026, 08:47 | Scor/rezultat | Eroare de compilare |
minplusmax.cpp: In function ‘int main()’: minplusmax.cpp:7:14: error: expected ‘;’ before ‘)’ token 7 | for(n<min) | ^ | ; minplusmax.cpp:7:10: warning: statement has no effect [-Wunused-value] 7 | for(n<min) | ~^~~~ minplusmax.cpp:9:5: error: expected primary-expression before ‘{’ token 9 | { | ^ minplusmax.cpp:8:15: error: expected ‘;’ before ‘{’ token 8 | min=n; | ^ | ; 9 | { | ~ minplusmax.cpp:9:5: error: expected primary-expression before ‘{’ token 9 | { | ^ minplusmax.cpp:8:15: error: expected ‘)’ before ‘{’ token 8 | min=n; | ^ | ) 9 | { | ~ minplusmax.cpp:7:8: note: to match this ‘(’ 7 | for(n<min) | ^ minplusmax.cpp:10:5: error: ‘else’ without a previous ‘if’ 10 | else | ^~~~ minplusmax.cpp:13:17: error: no match for ‘operator=’ (operand types are ‘std::basic_ostream<char>’ and ‘int’) 13 | cout<<s=min+max; | ^~~ In file included from /usr/include/c++/13/iostream:41, from minplusmax.cpp:1: /usr/include/c++/13/ostream:449:7: note: candidate: ‘std::basic_ostream<_CharT, _Traits>& std::basic_ostream<_CharT, _Traits>::operator=(std::basic_ostream<_CharT, _Traits>&&) [with _CharT = char; _Traits = std::char_traits<char>]’ 449 | operator=(basic_ostream&& __rhs) | ^~~~~~~~ /usr/include/c++/13/ostream:449:33: note: no known conversion for argument 1 from ‘int’ to ‘std::basic_ostream<char>&&’ 449 | operator=(basic_ostream&& __rhs) | ~~~~~~~~~~~~~~~~^~~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema MinPlusMax 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ă.