#172
Să se scrie un program care citește un șir de n numere naturale şi determină perechea de valori consecutive în șir pentru care valoarea absolută a diferenței este minimă.
| Problema | difMin | Operații I/O |
tastatură/ecran
|
|---|---|---|---|
| Limita timp | 0.1 secunde | Limita memorie |
Total: 64 MB
/
Stivă 8 MB
|
| Id soluție | #64889127 | Utilizator | |
| Fișier | difmin.cpp | Dimensiune | 845 B |
| Data încărcării | 09 Iunie 2026, 19:17 | Scor/rezultat | Eroare de compilare |
difmin.cpp: In function ‘int main()’: difmin.cpp:7:10: error: ‘dif’ is not a member of ‘std’; did you mean ‘div’? 7 | std::dif=a-b; | ^~~ | div difmin.cpp:8:10: error: ‘sum’ is not a member of ‘std’ 8 | std::sum=a+b; | ^~~ difmin.cpp:9:10: error: expected unqualified-id before ‘if’ 9 | std::if (dif<0) | ^~ difmin.cpp:11:10: error: ‘mindif’ is not a member of ‘std’ 11 | std::mindif=dif; | ^~~~~~ difmin.cpp:12:10: error: ‘minsum’ is not a member of ‘std’; did you mean ‘minus’? 12 | std::minsum=sum; | ^~~~~~ | minus difmin.cpp:13:10: error: ‘x’ is not a member of ‘std’ 13 | std::x=a; | ^ difmin.cpp:14:10: error: ‘y’ is not a member of ‘std’ 14 | std::y=b; | ^ difmin.cpp:15:10: error: ‘ant’ is not a member of ‘std’ 15 | std::ant=b; | ^~~ difmin.cpp:19:14: error: ‘dif’ is not a member of ‘std’; did you mean ‘div’? 19 | std::dif=a-ant; | ^~~ | div difmin.cpp:20:14: error: ‘sum’ is not a member of ‘std’ 20 | std::sum=a+ant; | ^~~ difmin.cpp:22:17: error: ‘dif’ is not a member of ‘std’; did you mean ‘div’? 22 | std::dif=0-dif; | ^~~ | div difmin.cpp:25:18: error: ‘mindif’ is not a member of ‘std’ 25 | std::mindif=dif; | ^~~~~~ difmin.cpp:26:18: error: ‘minsum’ is not a member of ‘std’; did you mean ‘minus’? 26 | std::minsum=sum; | ^~~~~~ | minus difmin.cpp:27:18: error: ‘x’ is not a member of ‘std’ 27 | std::x=ant; | ^ difmin.cpp:28:18: error: ‘y’ is not a member of ‘std’ 28 | std::y=a; | ^ difmin.cpp:34:18: error: ‘minsum’ is not a member of ‘std’; did you mean ‘minus’? 34 | std::minsum=sum; | ^~~~~~ | minus difmin.cpp:35:18: error: ‘x’ is not a member of ‘std’ 35 | std::x=ant; | ^ difmin.cpp:36:18: error: ‘y’ is not a member of ‘std’ 36 | std::y=a; | ^ difmin.cpp:39:14: error: ‘ant’ is not a member of ‘std’ 39 | std::ant=a; | ^~~
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema difMin 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ă.