#2271
Se dă un șir cu n numere întregi. Determinați cel mai mare număr care poate fi scris ca produs de două elemente ale șirului.
| Problema | ProdMax1 | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64690430 | Utilizator | |
| Fișier | prodmax1.cpp | Dimensiune | 685 B |
| Data încărcării | 23 Mai 2026, 13:58 | Scor/rezultat | Eroare de compilare |
prodmax1.cpp: In function ‘int main()’: prodmax1.cpp:6:22: error: ‘INT_MIN’ was not declared in this scope 6 | long long x,max1=INT_MIN,max2=INT_MIN,min1=INT_MAX,min2=INT_MAX; | ^~~~~~~ prodmax1.cpp:2:1: note: ‘INT_MIN’ is defined in header ‘<climits>’; did you forget to ‘#include <climits>’? 1 | #include <iostream> +++ |+#include <climits> 2 | prodmax1.cpp:7:5: error: ‘cin’ was not declared in this scope; did you mean ‘std::cin’? 7 | cin>>n; | ^~~ | std::cin In file included from prodmax1.cpp:1: /usr/include/c++/13/iostream:62:18: note: ‘std::cin’ declared here 62 | extern istream cin; ///< Linked to standard input | ^~~ prodmax1.cpp:13:17: error: ‘max2’ was not declared in this scope; did you mean ‘max1’? 13 | max2=max1; | ^~~~ | max1 prodmax1.cpp:17:18: error: ‘max2’ was not declared in this scope; did you mean ‘max1’? 17 | if(x>max2) | ^~~~ | max1 prodmax1.cpp:19:18: error: ‘min1’ was not declared in this scope 19 | if(x<min1) | ^~~~ prodmax1.cpp:21:17: error: ‘min2’ was not declared in this scope 21 | min2=min1; | ^~~~ prodmax1.cpp:25:18: error: ‘min2’ was not declared in this scope 25 | if(x<min2) | ^~~~ prodmax1.cpp:29:17: error: ‘max2’ was not declared in this scope; did you mean ‘max1’? 29 | if(max1*max2>min1*min2) | ^~~~ | max1 prodmax1.cpp:29:22: error: ‘min1’ was not declared in this scope 29 | if(max1*max2>min1*min2) | ^~~~ prodmax1.cpp:29:27: error: ‘min2’ was not declared in this scope 29 | if(max1*max2>min1*min2) | ^~~~ prodmax1.cpp:30:13: error: ‘cout’ was not declared in this scope; did you mean ‘std::cout’? 30 | cout<<max1*max2; | ^~~~ | std::cout /usr/include/c++/13/iostream:63:18: note: ‘std::cout’ declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~ prodmax1.cpp:32:13: error: ‘cout’ was not declared in this scope; did you mean ‘std::cout’? 32 | cout<<min1*min2; | ^~~~ | std::cout /usr/include/c++/13/iostream:63:18: note: ‘std::cout’ declared here 63 | extern ostream cout; ///< Linked to standard output | ^~~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema ProdMax1 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ă.