#282
Se dă un şir cu n elemente, numere reale, numerotate de la 1 la n. Determinaţi numărul de ordine al primei şi al ultimei apariţii a valorii maxime din şir.
| Problema | PozMax | Operații I/O |
pozmax.in/pozmax.out
|
|---|---|---|---|
| Limita timp | 0.2 secunde | Limita memorie |
Total: 32 MB
/
Stivă 8 MB
|
| Id soluție | #64816259 | Utilizator | |
| Fișier | pozmax.cpp | Dimensiune | 505 B |
| Data încărcării | 03 Iunie 2026, 11:04 | Scor/rezultat | 100 puncte |
In file included from /usr/include/c++/13/iostream:41, from pozmax.cpp:1: In member function ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>]’, inlined from ‘int main()’ at pozmax.cpp:25:13: /usr/include/c++/13/ostream:223:25: warning: ‘first’ may be used uninitialized [-Wmaybe-uninitialized] 223 | { return _M_insert(__f); } | ~~~~~~~~~^~~~~ pozmax.cpp: In function ‘int main()’: pozmax.cpp:12:24: note: ‘first’ was declared here 12 | double a, max = 0, first, last; | ^~~~~ In member function ‘std::basic_ostream<_CharT, _Traits>::__ostream_type& std::basic_ostream<_CharT, _Traits>::operator<<(double) [with _CharT = char; _Traits = std::char_traits<char>]’, inlined from ‘int main()’ at pozmax.cpp:25:29: /usr/include/c++/13/ostream:223:25: warning: ‘last’ may be used uninitialized [-Wmaybe-uninitialized] 223 | { return _M_insert(__f); } | ~~~~~~~~~^~~~~ pozmax.cpp: In function ‘int main()’: pozmax.cpp:12:31: note: ‘last’ was declared here 12 | double a, max = 0, first, last; | ^~~~
| Test | Timp | Mesaj evaluare | Scor posibil | Scor obținut | ||
|---|---|---|---|---|---|---|
| 1 | 0.001 secunde | OK. | 20 | 20 | Exemplu | |
| 2 | 0.001 secunde | OK. | 40 | 40 | ||
| 3 | 0.039 secunde | OK. | 40 | 40 | ||
| Punctaj total | 100 | |||||
www.pbinfo.ro permite evaluarea a două tipuri de probleme:
Problema PozMax 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ă.